Chorus

 view release on metacpan or  search on metacpan

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

Update `README.org`:
- `Agent status` section: KB ✓, YAML ✓, Helpers ✓ (or `-` if none)
- `Identified pipeline` section: complete table

Invalidate the infrastructure hash so the next `chorus-check` triggers a
full regeneration:

```bash
rm -f $SANDBOX/agent/.kb-hash
```

---

## Mode B — Incremental Enrichment (`--enrich` required)

Used **only** when `--enrich` is present in the command.
`<sandbox-name>` must exist and contain a KB.

### Phase B0 — Read existing KB

1. Read `agent/chorus/index.org` → current pipeline, known agents
2. Read each `agent/chorus/<slug>.org` → Slot dictionary, Rule catalog
3. Read existing YAML files → already codified rules

### Phase B1 — Analyze the new corpus

Classify each rule/prescription from the new corpus into **3 categories**:

| Category | Criterion | Action |
|---|---|---|
| **Refinement** | Concerns a Frame and slots already known | Add rule to an existing agent |
| **Extension** | Concerns new slots of a known Frame | Extend existing agent KB + new YAML rules |
| **New domain** | Concerns Frames or concepts absent from the KB | Create a new agent |

### Phase B2 — Save the new corpus

Number incrementally: `corpus/002-<slug-source>.txt`, `003-...`
Update the `Integrated corpus` table in `index.org`.

### Phase B3 — Apply changes

**Refinement case:**
- Open `agent/chorus/<slug>.org`
- Add the rule to `Rule catalog`
- Update `Slot dictionary` if new slots
- Generate the corresponding YAML file in `rules/<slug>/`
- If the rule requires a helper: add the helper to `Helpers.pm`
  and update `@EXPORT_OK`
- Verify idempotence and order of R<NN> files

**Extension case:**
- Update `Frame catalog` (new slots)
- Update `Slot dictionary`
- Add rules to `Rule catalog`
- Generate the new YAML files
- Add required helpers to `Helpers.pm`
- Verify that new slots do not conflict with those
  of other agents (Slot dictionary of the index)

**New domain case:**
- Apply Mode A (Phases 1 to 5.5) on the fragment only
- Determine the position of the new agent in the pipeline:
  - Does it read a slot set by an existing agent? → after it
  - Does it set a slot consumed by an existing agent? → before it
- Update `index.org`: insert the new agent at the correct position
- âš  Verify that the insertion does not break the chain of targeting slots

### Phase B4 — Enrichment closing

Update `README.org`:
- Add the row in `Corpus` (number + file + source + date)
- Update `Agent status` (KB, YAML, Helpers — new or enriched)
- Increment the enrichment counter of each modified agent

Invalidate the infrastructure hash so the next `chorus-check` triggers a
full regeneration:

```bash
rm -f $SANDBOX/agent/.kb-hash
```

---

## Mode C — Alias Harvest (`--harvest-aliases <import-report.org>`)

Used **only** when `--harvest-aliases` is present. No `<corpus>` argument is needed.
The sandbox must exist and contain a KB (at least one `<slug>.org` file).

**Purpose:** promote validated project-side terminology (from a past import) into the
KB `** Aliases` tables permanently. Future `chorus-import-project` runs on this sandbox
will resolve these terms at ✅ confidence without re-deriving them.

### Phase C0 — Read existing KB

Read each `$SANDBOX/agent/chorus/<slug>.org` into memory (Slot dictionary, Catalogue
des Frames, current `** Aliases` table). Build a fast-lookup map:
```
alias_map : { canonical_kb_form → set(known_aliases) }
```

### Phase C1 — Parse the import report

Read `<import-report.org>`. Extract the **alignment table** rows where:
- Confidence column = `✅` (certain)
- Decision column = confirmed (not rejected, not pending)

For each such row, collect:
```
(project_term, kb_slot_or_type, kb_value, source_file)
```

Ignore rows with `⚠️`, `❓`, `⛔` or `⬜` confidence — only ✅ mappings are harvested.

### Phase C2 — Deduplicate against existing aliases

For each `(project_term, kb_form)` pair:
- Look up `alias_map[kb_form]`
- If `project_term` (case-insensitive) **already present** → skip (log: "already known")
- If **absent** → mark as new

Output:



( run in 1.470 second using v1.01-cache-2.11-cpan-364913b4093 )