Skip to content

feat: semantic wiki layer with dedicated wiki-keeper sub-agent#2

Closed
workingfm wants to merge 1 commit intoLarens94:mainfrom
workingfm:feat/codedna-wiki-semantic-layer
Closed

feat: semantic wiki layer with dedicated wiki-keeper sub-agent#2
workingfm wants to merge 1 commit intoLarens94:mainfrom
workingfm:feat/codedna-wiki-semantic-layer

Conversation

@workingfm
Copy link
Copy Markdown
Contributor

Summary

  • Adds codedna wiki — explicit CLI subcommand to scaffold the semantic wiki layer, independent of codedna init and any external plugin (GSD, OpenCode, etc.)
  • Adds codedna_tool/wiki.py — scaffold helper that creates 3 assets idempotently: skill, wiki, and Claude Code sub-agent
  • Adds .agents/skills/create-wiki/SKILL.md — cross-runtime skill with model: haiku / preferred-model: haiku / model-hint fields for token-efficient execution on Claude Code, Codex, OpenCode, and Gemini
  • Adds .claude/agents/codedna-wiki-keeper.md — Claude Code sub-agent (model: haiku) that isolates all wiki reads/writes from the main agent context window
  • Adds codedna-wiki.md — semantic companion to .codedna (L0), following the Karpathy llm-wiki pattern: persistent compiled knowledge, not a cache rebuilt every session
  • Wires wiki scaffold into codedna init (idempotent, never overwrites existing files)
  • Adds AGENTS.md for Codex runtime integration
  • Updates .gitignore: excludes .planning/ and .claude/settings.local.json

Design decisions

Standalone autonomy: codedna wiki has zero dependency on GSD or any other plugin. Works with .codedna, pure Python stdlib, and text templates only.

Context isolation: In Claude Code, create-wiki skill instructs the orchestrator to spawn codedna-wiki-keeper via the Agent tool. The keeper runs on Haiku, reads only what .codedna says is relevant, and returns a compact summary. Main agent context stays clean.

Cross-runtime model hints: The skill frontmatter carries model: haiku, preferred-model: haiku, and a model-hint string with per-runtime equivalents (o4-mini for Codex, gemini-flash for Gemini). Claude Code is the only runtime that enforces the model; others read it as advisory.

Idempotency: Every scaffold path checks existence before writing. Re-running codedna wiki or codedna init reports "Reused" and never overwrites user-authored content.

Test plan

  • codedna wiki creates all 3 assets from scratch
  • codedna wiki --dry-run reports without writing
  • codedna wiki is idempotent on re-run
  • .claude/agents/codedna-wiki-keeper.md contains model: haiku
  • create-wiki/SKILL.md references codedna-wiki-keeper and haiku
  • codedna init still scaffolds wiki assets (existing tests pass)
  • 21 CLI tests pass, 36 refresh/validator tests pass

🤖 Generated with Claude Code

- Add `codedna wiki` subcommand — explicit, idempotent wiki scaffold
- Add `codedna_tool/wiki.py` — scaffold helper for 3 wiki assets
- Add `.agents/skills/create-wiki/SKILL.md` — cross-runtime skill with
  model hints (haiku/o4-mini/gemini-flash) for token-efficient execution
- Add `.claude/agents/codedna-wiki-keeper.md` — Claude Code sub-agent
  (model: haiku) that isolates wiki reads from main agent context
- Add `codedna-wiki.md` — semantic companion to .codedna (L0)
- Wire wiki scaffold into `codedna init` (idempotent, non-destructive)
- Add AGENTS.md for Codex runtime integration
- Update .gitignore: exclude .planning/ and .claude/settings.local.json
- Add 6 new tests (scaffold, haiku model, sub-agent ref, dry-run, idempotent)

AI-Agent:    claude-opus-4-7
AI-Provider: anthropic
AI-Session:  s_20260419_001
AI-Visited:  .codedna,codedna_tool/cli.py,codedna_tool/wiki.py,tests/test_cli.py,.agents/skills/create-wiki/SKILL.md,.claude/agents/codedna-wiki-keeper.md,codedna-wiki.md,AGENTS.md,.gitignore
AI-Message:  wiki scaffold is standalone (no GSD/plugin dep); haiku enforced in CC, advisory via model-hint in other runtimes
@Larens94
Copy link
Copy Markdown
Owner

Ciao @workingfm ,

grazie per questa PR, l'ho studiata a fondo nelle ultime ore e volevo aggiornarti. Ho preso il tuo lavoro, l'ho adattato al nostro protocollo v0.9 e l'ho messo su un branch sperimentale: experiment/wiki-field.

Cosa ho integrato dalla tua PR:

Il template narrativo a 7 sezioni del codedna-wiki.md → ora in docs/codedna-wiki.md, generato via codedna wiki sync
La filosofia ".codedna è L0 truth, wiki è semantic layer" → nel template e nel messaggio chi lo apre legge "If this file disagrees with .codedna, trust .codedna and refresh"
Il tuo AGENTS.md → portato a v0.9 per includere related:, wiki: e il protocollo di session end
Co-author in 2 commit (c4f0db7, daeb3cc)
Attribution esplicita nei commenti di codedna_tool/wiki.py e dentro il file docs/codedna-wiki.md generato
Cosa ho scartato, e perché (vorrei il tuo parere):

Il sub-agent codedna-wiki-keeper e la skill create-wiki/SKILL.md. Motivo: il progetto ha già pre/post-commit hooks come meccanismo di enforcement, e sui nostri benchmark SWE-bench gli agenti dimenticano spesso le istruzioni scritte in markdown. Gli hooks sono hard-enforced, non dipendono dalla memoria dell'agente. Per questo ho preferito un codedna wiki sync deterministico che si aggancia al post-commit hook.
Cosa ho aggiunto in più sul branch:

Un nuovo campo opzionale wiki: nel docstring v0.9 — punta a un markdown curato per quel file specifico. Quando presente nel docstring, il vault Obsidian mostra un arco esplicito verso la pagina curata (il tuo approccio diventa opt-in per file).
codedna wiki bootstrap genera anche un vault Obsidian per-file sotto docs/wiki/, con [[wikilinks]] dai grafi used_by: e related:.
Vorrei sapere cosa ne pensi. Due possibili strade:

Se sei ok con l'adattamento, posso mergiare experiment/wiki-field in main e chiudere questa PR citandoti nel changelog.

codedna-wiki-flow obsidian

Grazie davvero per il lavoro iniziale

Fabrizio

Larens94 pushed a commit that referenced this pull request Apr 21, 2026
…dated to v0.9)

workingfm's original PR #2 contributed AGENTS.md as a Codex-compatible
counterpart to CLAUDE.md. We bring it in here but synchronized with the
current v0.9 protocol:

- includes the `related:` field (v0.9 addition for cross-cutting semantic links)
- includes the `wiki:` optional field (experimental v0.9, from this branch)
- includes the inline `# Rules:` / `# message:` annotation patterns
- includes the session_end protocol with AI git trailers
- mirror of CLAUDE.md — only the top header differs, so Codex/OpenCode/Aider
  users get the same guidance Claude Code users get via CLAUDE.md

Keep the two files in sync when the protocol evolves. Easiest: edit
CLAUDE.md then `diff CLAUDE.md AGENTS.md` and patch the header back.

Co-authored-by: workingfm <workingfm@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Larens94 pushed a commit that referenced this pull request Apr 21, 2026
…GENTS.md

Merges experiment/wiki-field (8 commits) into main.

Changes:
- codedna wiki bootstrap generates a nested Obsidian vault under docs/wiki/
  (mirrors source tree, [[wikilinks]] from used_by:/related: graphs)
- codedna wiki sync regenerates docs/codedna-wiki.md (7-section narrative wiki,
  template by @workingfm PR #2)
- New opt-in wiki: field in docstrings — auto-generated pages render a
  "📖 Extended documentation" callout with a clickable [[wikilink]] to the
  curated page; the arc is visible in the Obsidian graph
- fix(validator): _parse_fields now recognises optional fields (wiki:/related:/
  message:) — previously they were silently folded into the previous field
- fix(wiki): escape numeric hashtags (#1072-1077) to prevent Obsidian tag nodes
- fix(wiki): drop phantom nodes from placeholder values (none/n/a/tbd) and
  literal [[wikilink]] text in Rules/agent entries
- AGENTS.md added at repo root for Codex/OpenCode/Aider runtimes (from PR #2,
  updated to v0.9 — includes related:, wiki:, session-end protocol)

Co-authored-by: workingfm <workingfm@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Larens94
Copy link
Copy Markdown
Owner

Larens94 commented Apr 21, 2026

Mergiato in main con e83534b. Grazie @workingfm — il tuo contributo è integrato con co-authorship. Se hai feedback sul branch o vuoi contribuire altro, apri una nuova PR.

@Larens94 Larens94 closed this Apr 21, 2026
@workingfm
Copy link
Copy Markdown
Contributor Author

Mergiato in main con e83534b. Grazie @workingfm — il tuo contributo è integrato con co-authorship. Se hai feedback sul branch o vuoi contribuire altro, apri una nuova PR.

Grazie mille Fabrizio! @Larens94 gentilissimo!🤟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants