From d406a0a554e29b07fe00d9418570a8f8dd348e7f Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Mon, 11 May 2026 10:16:15 +0200 Subject: [PATCH] refactor(agent): Refine ingest, query, and lint workflows --- templates/agents-genome.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/templates/agents-genome.md b/templates/agents-genome.md index f561291..a5f7f86 100644 --- a/templates/agents-genome.md +++ b/templates/agents-genome.md @@ -59,10 +59,11 @@ Session end or return to `disabled`: remind operator to run `git-crypt lock` on Execute in this order before any file operation: -1. Read `wiki/index.md` — full catalog of all pages and their maturity. -2. Read the last 20 log entries injected by orchestrator — do not open `wiki/log.md` directly. -3. For any task involving related pages: `qmd search ""` before opening files. -4. Operate on individual target files. Never scan entire directories. +1. **One source per session.** If multiple sources are queued in `raw/`, process only the first. Commit, close session. The orchestrator starts a new session for the next source. +2. Read `wiki/index.md` — full catalog of all pages and their maturity. +3. Read the last 20 log entries injected by orchestrator — do not open `wiki/log.md` directly. +4. For any task involving related pages: `qmd search ""` before opening files. +5. Operate on individual target files. Never scan entire directories. --- @@ -78,7 +79,8 @@ Execute in this order before any file operation: 5. Check each touched page for contradictions → apply §Conflict if found. 6. Append entry to `wiki/index.md` (bottom of relevant section). 7. Append log entry: `INGEST | `. -8. Commit on `feat/ai-ingest-`. Open PR. +8. Run scoped lint on pages created or modified in this session. Report issues in PR description. Do not auto-fix. +9. Commit on `feat/ai-ingest-`. Open PR using `templates/pr-description.md`. *Private source* (`PRIVATE_CONTEXT: enabled` required): - All output → `wiki/private/.md` only. @@ -88,24 +90,28 @@ Execute in this order before any file operation: *Triggered by operator question.* 1. `qmd search ""` → identify candidate pages. -2. Read relevant pages via `wiki/index.md` catalog. +2. Read candidate pages directly. 3. Synthesize answer with `[[wikilink]]` citations. 4. If answer is non-trivial: save as `wiki/queries/.md`. 5. Append entry to `wiki/index.md` under Queries. 6. Append log entry: `QUERY | `. +*For general orientation without a specific query: read `wiki/index.md` directly.* + ### Lint -*Triggered by operator or schedule.* +*Triggered by operator with bash pre-scan output.* -Find and report — do not auto-fix without operator approval: +Pre-requisite: operator runs `bash scripts/lint-genomes.sh` and provides output to this session. +The script handles deterministically: broken links, knowledge decay, page size, frontmatter validation. -1. Orphan pages — no inbound `[[wikilink]]`. -2. Duplicate concepts — two pages covering same topic → propose merge. -3. Implicit concepts — term in 3+ pages with no dedicated page. -4. `maturity: draft` with 2+ sources → propose promote to `stable`. -5. Broken internal links. -6. Knowledge decay violations (§Decay). +Agent tasks — apply semantic judgment to bash findings + independent semantic checks: +1. **Orphan pages** (list from bash): for each orphan, identify 1-3 existing pages that should link to it. Propose specific link additions. +2. **Implicit concepts** (term list from bash): for each candidate term, determine if a dedicated page is warranted. If yes, draft stub. +3. **Duplicate concepts**: `qmd search ""` for suspected duplicates → propose merge if confirmed. +4. **`maturity: draft`** pages with 2+ sources cited → propose promote to `stable`. + +Report all findings as structured list. Do not modify files without operator approval. Append log entry: `LINT | `. ---