Appearance
Build a feature wiki from merged pull requests
Codebase wiki keeps a living, feature-organized wiki of a repository. The GitHub channel acknowledges every closed pull request instantly, fetches a compact digest on the host, and spends a model turn only on merged PRs. The turn maps the change onto feature pages; a daily schedule writes a digest of what changed and rebuilds the index. Chat sessions answer codebase questions from the wiki with page citations.
Use this project when documentation should accumulate from merges instead of being regenerated from scratch. Use Knowledge base when people should curate organizational context through conversation.
Browse the codebase wiki source.
Treat PRs as evidence and features as pages
The wiki refuses to become a merge log:
- The page tree is rigid:
index,features/<slug>, anddigests/<yyyy-mm-dd>. The store rejects anything else, so the wiki can't sprawl. - The
feature-mappingskill requires awiki_searchbefore every write. A PR updates the page that owns its feature; a new page needs a genuinely new feature; chores change nothing. - Every touched page gets a dated changelog entry citing the PR number, so each fact traces back to a merge.
The wiki itself is markdown on the serve host, in .agent-serve/wiki/ by default with a CODEBASE_WIKI_DIR override. Sessions are disposable; the wiki is the durable state.
Follow a merged PR
- GitHub delivers
pull_requestwith actionclosed. The channel returns a task acknowledgement immediately. - The task fetches the digest with the host
ghCLI: title, body, labels, changed files, and a bounded diff excerpt. No checkout. - The webhook payload can't say whether the PR merged, so the host checks
mergedAtand skips abandoned PRs without a model turn. - For merged PRs, the task starts the turn with
pr/DIGEST.mdseeded throughworkspaceFilesand apr:<owner/repo#N>continuation token, so redeliveries resume instead of double-ingesting. - The model follows
feature-mapping: search, update or create feature pages, add changelog entries, and refreshindexwhen pages were added.
In chat, "ingest PR #123" runs the same flow through the ingest_pr tool, which writes the digest into the active session workspace.
Map the wiki files
| File | Purpose |
|---|---|
agent/agent.ts | Selects the cloud runtime and model. |
agent/instructions.md | Splits the job into merge ingestion and wiki-cited Q&A. |
agent/lib/wiki-store.ts | Enforces the rigid page tree and owns reads, writes, and search. |
agent/lib/pr-digest.ts | Fetches PR metadata and diff, and formats pr/DIGEST.md. |
agent/tools/ingest_pr.ts | Exposes host digest preparation for chat-driven backfills. |
agent/tools/wiki_read.ts, wiki_search.ts, wiki_write.ts | Read, search, and rewrite wiki pages. |
agent/skills/feature-mapping.md | Maps changes onto features and fixes the page and changelog shape. |
agent/schedules/daily-digest.md | Writes digests/<date>, rebuilds the index, and flags stale pages. |
agent/channels/github.ts | Acknowledges closed PRs and starts merged-only ingest turns. |
agent/storage.ts | Persists sessions and events with cursorHostedStorage. |
evals/evals.config.ts | Caps eval run concurrency. |
evals/ingest.eval.ts | Gates ingest decisions against the wiki filesystem. |
There is no MCP connection, subagent, hook, A/B experiment, or custom storage.
Prepare credentials and services
You need:
- Node 22.13 or newer.
- An agent-runtime credential for model turns.
ghonPATHwith read access to the PRs you ingest.
The channel verifies webhook signatures when GITHUB_WEBHOOK_SECRET is set and narrows repositories with CODEBASE_WIKI_REPOS=owner/repo,owner/other. The agent never writes to GitHub. Its only side effects are wiki files on the serve host.
Validate the surface
bash
agent-sdk validate --dir examples/codebase-wiki
agent-sdk info --dir examples/codebase-wiki --jsonThe manifest should report four server tools, one skill, one schedule, and the authored GitHub channel.
Ingest without webhook plumbing
Replay a real merged PR as a closed delivery:
bash
agent-sdk dev examples/codebase-wiki
agent-sdk github replay https://github.com/owner/repo/pull/123 \
--dir examples/codebase-wiki --action closedThe reply is a 202 acknowledgement; the ingest continues in the task. Watch the session in the playground, then read the result on disk:
bash
ls examples/codebase-wiki/.agent-serve/wiki/features/Each ingested feature page carries an overview, a "How it works" section, and a changelog line citing the PR. Deterministic digest preparation works without a model turn:
bash
agent-sdk call ingest_pr \
--dir examples/codebase-wiki \
--input '{"pr":"https://github.com/owner/repo/pull/123"}'A PR closed without merging returns merged: false and a note telling the model to change nothing.
Run the daily digest
The schedule fires at 07:00 UTC. Under agent-sdk dev, trigger it by hand:
bash
curl -s -X POST http://127.0.0.1:3000/codebase-wiki/v1/dev/schedules/daily-digestThe turn reads every feature changelog, writes digests/<today> grouped by feature with PR citations, rebuilds index, and reports one line per page it wrote. Entries dated today always count; a digest only claims a quiet day when no entry qualifies.
Run the evals
bash
agent-sdk eval --dir examples/codebase-wiki --list
agent-sdk eval --dir examples/codebase-wiki ingest/update-existingThe cases seed a temp wiki through CODEBASE_WIKI_DIR and build digests with the same formatter the channel uses, so they run without GitHub or network access. The gates check the filesystem, not prose: a new feature page lands on a new slug, a related PR updates the existing page instead of duplicating it, an unmerged PR changes nothing, and the daily pass writes a digest naming both seeded features.
Reuse the merge-ingestion pattern
Copy this shape when events should accumulate into curated state:
- Acknowledge webhooks with a task and decide host-side whether a model turn is worth spending.
- Seed evidence through
workspaceFilesso the model never fetches. - Constrain the durable store's shape in code and its content in a skill.
- Add a consolidation schedule so incremental writes stay coherent.