Chorus

 view release on metacpan or  search on metacpan

agent/skills/chorus-strengthen.md  view on Meta::CPAN


---

## Phase 4 — Produce the gap report

Display a structured report:

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  chorus-strengthen  <sandbox-name>
  <N> gap(s) detected across <M> project file(s)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

For each gap, one entry:

```
  ── Gap #N — <gap-type> ─────────────────────────────────────
  Element    : <id>  (<type_element>)  in <projet-file>
  Expected   : <CONFORME|NON_CONFORME>
  Got        : <CONFORME|NON_CONFORME|unprocessed>
  Rule fired : <R0N-slug> — "<rule name>"  (or: none)
  Agent      : <agent-slug>

  Hypothesis : <concise description of the probable cause>
               e.g. "Threshold for slot 'hauteur_libre' is set to 2.50 m
                     in R02 but the corpus §4.2 states 2.40 m for class C."

  Corpus ref : §<N> — <section title> — <document>
               (or: unknown — needs manual verification)

  Suggested fix:
    → YAML: adjust CONDITION/threshold in <R0N-slug>.yml
    → OR: add new rule R<NN>-<slug>.yml covering this case
    → OR: Feed: add 'besoin_<slug>' to %SLOTS_REQUIS for type <X>
```

After all gaps:

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Summary by gap type
  Rule too strict    : N gap(s)  → thresholds or CONDITION to relax
  Rule too permissive: N gap(s)  → missing rules or thresholds to tighten
  Feed gap           : N gap(s)  → %SLOTS_REQUIS or Feed logic to extend
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

---

## Phase 5 — Enrichment roadmap

### 5.1 Group gaps by corrective action

Group all gaps into three buckets:

| Bucket | Content | Action |
|---|---|---|
| **A — Corpus clarification** | Gaps where the normative source is unclear or ambiguous | Need to re-read the original corpus §, possibly extract a correction text |
| **B — Rule adjustment** | Gaps where the corpus reference is known and the fix is a threshold / CONDITION change | Direct YAML edit (does not require `chorus-feed --enrich`) |
| **C — Missing coverage** | Gaps where the KB has no rule at all for this case | New rule needed → `chorus-feed --enrich` with a targeted corpus fragment |

### 5.2 Enrichment corpus recommendation

For bucket **C** (missing coverage), produce a recommendation:

```
Recommended enrichment corpus
──────────────────────────────
For each missing-coverage gap, draft the normative text fragment that covers it.
This text should be passed to:

  chorus-feed <sandbox-name> <corpus-correctif.txt> --enrich

Suggested corpus-correctif.txt content:
─────────────────────────────────────────
[Gap #N — <type>/<slot>]
<Normative extract or paraphrase covering the missing rule.
 Include: element type, triggering condition, threshold value, rejection reason.>

[Gap #M — <type>/<slot>]
<...>
─────────────────────────────────────────
After running chorus-feed --enrich, re-run:
  chorus-check <sandbox-name> --all
  chorus-strengthen <sandbox-name>   ← to verify convergence
```

### 5.3 Convergence loop reminder

```
Reinforcement loop:
  chorus-create-project <sb> --batch          ← (once, or if suite is stale)
       ↓
  chorus-strengthen <sb>                      ← identify gaps
       ↓
  [edit YAML directly]                        ← bucket B fixes
  chorus-feed <sb> corpus-correctif.txt --enrich  ← bucket C new rules
       ↓
  chorus-check <sb> --all                     ← verify
       ↓
  chorus-strengthen <sb>                      ← check convergence
       ↓
  ✅ CONVERGED  — all projects pass, 0 discordances
```

---

## Separation of responsibilities

| | `chorus-feed` | `chorus-create-project` | `chorus-check` | `chorus-strengthen` |
|---|---|---|---|---|
| **Reads** | corpus | sandbox org KB | org KB + YAML | pipeline output + org KB |
| **Produces** | KB org, YAML, Helpers.pm | `projet-*.json` | Feed.pm, Agent shells, Expert.pm, run.pl | gap report + enrichment roadmap |
| **Modifies KB** | ✅ | ✗ | ✗ | ✗ |
| **Modifies YAML** | ✅ | ✗ | ✗ | ✗ |
| **Triggered by** | new standard | coverage need | project to validate | failed `chorus-check --all` |



( run in 0.934 second using v1.01-cache-2.11-cpan-8dfa8b56332 )