Skip to content

Inject knowledge-wiki index (wiki/INDEX.md) into session context - #475

Open
kayeungadrian-tam wants to merge 1 commit into
andrewyng:mainfrom
kayeungadrian-tam:feat/wiki-index-injection
Open

Inject knowledge-wiki index (wiki/INDEX.md) into session context#475
kayeungadrian-tam wants to merge 1 commit into
andrewyng:mainfrom
kayeungadrian-tam:feat/wiki-index-injection

Conversation

@kayeungadrian-tam

Copy link
Copy Markdown

What this adds

A convention: a workspace that maintains a long-lived knowledge base keeps it as markdown pages under wiki/ with an INDEX.md map-of-content. At engine build, ONLY the index is injected into the system prompt (alongside AGENTS.md), with a short preamble telling the agent to open pages on demand and revise them in place. No wiki/ → zero change to behavior. Index capped at 6k chars.

This is the same progressive-disclosure trick the skills catalog already uses, applied to knowledge: sessions carry a map of what is known at flat context cost, while the knowledge itself grows without bounding context.

Why (field evidence)

Running a 24/7 self-waking monitoring agent (heart-rate + room-climate guardian) surfaced the limit of flat memory: append-only entries that are 80% duplicates ("still 26.5°C…" × N cycles). Restructuring its knowledge as a git-backed wiki — living pages, revised in place, [[wikilinked]], with a nightly consolidation automation — worked immediately: the consolidator's first unsupervised run correctly concluded "no durable knowledge today", touched one timestamp line, and committed. The missing platform piece was sessions knowing the wiki exists without being told: this PR.

Pairs naturally with the existing AGENTS.md ingestion (same file, same injection site) and with git-tracked workspaces (page history = provenance for every belief an agent holds).

Change

  • project.py: load_wiki_index() — reads <workspace>/wiki/INDEX.md, caps at 6k, wraps with usage preamble
  • agent.py: inject after AGENTS.md in build_engine
  • 3 tests: injection content, absence → no-op, truncation

pytest tests/test_skills.py: 9/9.

🤖 Generated with Claude Code

Workspaces that maintain a long-lived knowledge base as markdown pages under
wiki/ get their INDEX.md injected at engine build, alongside AGENTS.md — the
progressive-disclosure trick the skills catalog already uses: sessions carry a
map of what is known at flat context cost; pages load on demand via file
tools. Absent wiki/ ⇒ zero change. Index capped at 6k chars with a nudge.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant