The skill defines init, sync, query, verify, impact, lint, and status workflows for a Git-based software knowledge base. It requires claims and verification results to be tied to code, tests, requirements, and commits, while preserving human approval for requirements and review of findings. Optional GitHub Actions guidance describes automating wiki updates and pull-request impact reports.
A living, evidence-backed software knowledge base that continuously tracks business features, implementation, requirements, and verification across an evolving codebase.
This is the codebase companion to llm-wiki. Use llm-wiki for a wiki built from documents such as articles, papers, or notes. Use codebase-wiki when the source is a Git repository and every claim must point to code, tests, or an approved requirement.
/codebase-wiki <ACTION> [ARGUMENTS]
wiki/)HEAD)wiki/
├── AGENTS.md # Schema: conventions and per-action workflows (from templates/schema.md)
├── index.md # Catalog of every page with a one-line summary
├── overview.md # What the system does, for whom, and its main parts
├── log.md # Append-only record of every action, with commit SHAs
├── architecture/ # Modules, layers, runtime topology
├── features/ # One page per business feature (from templates/feature.md)
├── business-rules/ # Approved requirements, grouped by domain, with REQ IDs
├── data-models/ # Entities, schemas, state machines
├── integrations/ # External services, queues, webhooks, third-party APIs
├── decisions/ # Links to ADRs or short decision records
└── verification/ # Verification reports (from templates/verification.md)There is no raw/ directory. Do not copy source code into the wiki. Git is the source history: cite files, symbols, and line ranges at a commit SHA.
Templates are in $SKILL_PATH/templates/. $SKILL_PATH/scripts/evidence.sh runs the Git checks that have one right answer: the dirty-tree check, staleness, sync coverage, the checkpoint, and ignored-file hashes. Use its output; do not rebuild these checks by hand. evidence.sh help explains every output line. It needs only Bash and Git.
These rules apply to every action. They are the reason this skill exists.
Every claim has a state. Use exactly one of:
| State | Meaning | Required evidence |
|---|---|---|
| Observed | The source code shows it. | File reference (path:line or path#symbol) |
| Verified | An executed test on a clean tree shows it. | Test ID, the command that ran it, the result, and its commit |
| Inferred | Reasoned from names, docs, or patterns, not confirmed in code. | The basis for the inference |
| Unknown | Not established. | The open question |
| Stale | The page's evidence set changed after the commit the claim cites. | The commit range or the uncommitted files that changed it |
Verified needs an executed test at a clean commit. Reading a test file only makes the claim Observed. Use Verified only when you ran the test on a clean working tree (rule 3), or when CI results for that exact commit show the test passed. Record the command or the CI run link, and record that commit as verified_at.
A dirty tree is not a commit. Before and after the tests, run evidence.sh dirty --wiki <wiki-dir> --evidence <path1> --evidence <path2> ..., with one --evidence flag for each of the page's sources, depends_on, and test paths. Exit 1 means dirty. Two cases need your judgment: a build output such as dist/ blocks when the tests use it and this run did not rebuild it from the cited commit; and a test command that changed a tracked file, such as a snapshot update, makes the run dirty. A dirty result belongs to the working tree, not to HEAD: record it as dirty (base <short-sha>) with the BLOCK lines. It never makes a claim Verified, a scenario Passed or Failed, or a requirement Met. Report it as provisional and ask the user to commit or stash. Claims also cite a commit, so read files in the evidence set from that commit: when a file has uncommitted changes, read it with git show <sha>:<path>, or list it as dirty.
Expected behavior comes from requirements, not from code. Expected behavior cites a REQ ID in business-rules/. When the code does something different, record a mismatch. Do not edit the expected behavior to match the code. A human decides whether the code or the requirement is wrong.
Requirements are human-approved. When you find a rule with no requirement, add a draft REQ ID with state Inferred and approved: no. Do not mark it approved yourself. Set Approved: yes only with a citation of who approved it and when: the user confirmed it in this session, or the source document records the approval (for example a spec with its owner, version, and date). Never write Approved: yes (assumed). When you are not sure that a source counts as approval, keep Approved: no and ask the user. A draft requirement is never Met, even when every test passes.
Every page records two commits and an evidence set.
checked_at: the commit at which the claims were last read against the code.verified_at: the clean commit at which the page's tests last ran. Each Verified claim and each test result keeps its own commit.sources: the files the page cites. depends_on: plain paths of what those files rely on outside the page, such as imported modules, shared middleware and utilities, environment and config files, lockfiles, and database migrations or schemas.Updating checked_at never changes verified_at or the commit of an earlier test result. Do not move test evidence to a newer commit without a new run.
Staleness covers the whole evidence set. Run evidence.sh stale <page>. Exit 1 means Stale, and exit 3 means incomplete: STALE observed lines apply to claims that cite checked_at, and STALE verified lines to claims and scenario results that cite verified_at. Keep depends_on as plain paths, and record ignored files that the sources rely on (such as .env.test) in ignored_hashes with evidence.sh hash <path>.... A test result with its own commit older than verified_at uses that commit: git diff --name-only <sha> HEAD -- <paths>. INCOMPLETE means the staleness check is incomplete: say so, and do not call the page current.
Scenarios use Passed, Failed, or Untested. Passed and Failed need a clean test run, as in rule 2, that is not Stale under rule 7. A scenario with no test, with a test you did not run, or with a Stale result is Untested. Keep the last result and its commit in the Last run column, so the history stays visible.
Do not guess. When evidence is missing, write Unknown and the open question. An honest gap is better than a confident claim with no evidence.
# Order Cancellation
Requirements: REQ-ORDER-003 · checked_at: 4f2a9c1 · verified_at: 4f2a9c1
depends_on: src/auth/session.ts, src/db/orders.ts, migrations/
## Expected behavior
Customers can cancel their own unfilled orders. (REQ-ORDER-003)
## Actual implementation
- `cancelOrder` checks ownership before it changes state. — Observed (`src/orders/cancel.ts:18`)
- Filled orders are rejected with `ORDER_ALREADY_FILLED`. — Verified (`cancel.test.ts` › "rejects filled order", `bun test src/orders`, 4f2a9c1)
## Verification scenarios
| Scenario | Requirement | Test | Status | Last run |
| ------------------------ | ------------- | ------------------------------------- | -------- | ---------------- |
| Cancel open order | REQ-ORDER-003 | cancel.test.ts › cancels open order | Passed | Passed @ 4f2a9c1 |
| Reject unauthorized user | REQ-ORDER-003 | cancel.test.ts › rejects other user | Passed | Passed @ 4f2a9c1 |
| Reject filled order | REQ-ORDER-003 | cancel.test.ts › rejects filled order | Passed | Passed @ 4f2a9c1 |
| Concurrent execution | REQ-ORDER-003 | none | Untested | never |
## Known risks
- Race between cancel and order execution: no lock or version check in `src/orders/cancel.ts`. — Observedgit rev-parse HEAD as the initial checked_at.llm-wiki wiki.$SKILL_PATH/templates/schema.md to DIRECTORY/AGENTS.md and fill in the project section.overview.md, pages in architecture/, data-models/, and integrations/, and one page per selected feature from $SKILL_PATH/templates/feature.md. Apply the evidence rules. Fill in depends_on for each page from the imports of its sources and from the shared middleware, config, lockfiles, and migrations they use. Record ignored files in ignored_hashes with evidence.sh hash. Leave verified_at empty until a clean test run. For requirements taken from a spec, set Approved: yes only as evidence rule 5 allows, and list every requirement you left Approved: no for the user to confirm. Put approved requirements in business-rules/<domain>.md. Put rules you found without an approved source there as drafts.index.md with every page and a one-line summary.log.md: ## [YYYY-MM-DD] init | <short-sha> | <N> features./codebase-wiki verify <feature> next.Done when: the user has chosen the features, and every selected feature has a page with all template sections, every claim has a state and evidence, every page has checked_at, and index.md and log.md are written.
evidence.sh checkpoint --wiki <wiki-dir>. The default range is <checkpoint>..HEAD.evidence.sh range --wiki <wiki-dir> <start>..<end> for the TOUCHED files, and evidence.sh dirty --wiki <wiki-dir>: pages whose evidence set has uncommitted changes are affected too. Mark their claims and scenarios Stale, and do not attribute what you read in those files to a commit (rule 3).sources or depends_on list a changed file, and pages that cite a symbol the diff changed (rg the wiki for the file path and the symbol names). For changed files that no page lists, follow importers and callers as in impact step 2.depends_on. Mark claims you did not recheck as Stale.verified_at and each scenario's Last run. Set the Status of a scenario whose evidence set changed to Untested, and mark its Verified claims Stale. Do not delete or re-date the earlier result.status: removed instead of deleting them.checked_at on each page you rechecked, and update index.md.COVERS line of step 2. COVERS yes: append ## [YYYY-MM-DD] sync | <start>..<end> | <N> pages, which moves the checkpoint to <end>. COVERS no: append ## [YYYY-MM-DD] sync-partial | <start>..<end> | <N> pages, which leaves the checkpoint where it was, and report the REASON and the UNSYNCED commits.Done when: every page whose evidence set changed is rechecked or marked Stale, no test result has moved to a commit it did not run at, the log entry is sync only when the range covers everything since the checkpoint, and the report lists every behavior change and mismatch.
index.md and the relevant pages.evidence.sh stale <page> (evidence rule 7). If it exits 1 (Stale) or 3 (incomplete), read the current code before you answer, and say that the page is stale or that its check is incomplete.index.md, and log.md.Done when: the answer cites code or test evidence for each claim, states each claim's state, and reports stale pages.
business-rules/ and the feature page. Note which ones are approved: no.evidence.sh dirty as in evidence rule 3, before and after the test run. If the tree is dirty at either check, follow rule 3: you can run the tests for a provisional result, but no scenario becomes Passed or Failed. Otherwise run the relevant tests with the project's existing test runner. When the project can run there, run them in a fresh git worktree checked out at the clean commit, so edits in the main checkout during the run cannot reach the tested code. Run evidence.sh dirty inside the worktree too, before and after the tests, because a test that changes a tracked file there does not show in the main checkout. A fresh worktree has no ignored files, so copy in the ignored inputs the tests need, such as .env.test, and record them with evidence.sh hash; if you cannot, run in place. When you run in place, rely on both tree checks in the main checkout. They do not see an edit that another process, such as an editor or another agent, makes and reverts during the run: run in place only when nothing else writes to the checkout, or record the result as provisional. The checks also do not protect against a test command that edits tracked source and restores it before it exits, such as a mutation tester, a code generator, or a fixture swap restored in teardown. If the test command does that, the result is provisional, as in rule 3, unless you can show the tested source matched the commit, for example by running on a read-only checkout. Record the command, the clean commit, and the result of each test.$SKILL_PATH/templates/verification.md at verification/<feature>-<YYYY-MM-DD>-<short-sha>.md. If that file already exists, add -2, -3, and so on. Never overwrite an earlier report. Give each requirement one verdict:
checked_at, verified_at, and a link to the report. After a dirty run, leave checked_at and verified_at unchanged and record the dirty base in the report only.log.md: ## [YYYY-MM-DD] verify | <feature> | <short-sha> | <met>/<total> met.Done when: every requirement has a verdict with evidence, the derived scenarios are in the report, no draft requirement is Met, no dirty run counts as verification, the report and feature page are updated, and the gaps are reported. If the tests cannot run, report that. Leave the affected requirements Unverified, except those the implementation contradicts, which stay Not met.
This action is read-only. It does not edit the wiki.
gh pr diff), or the file list. The default is the uncommitted and staged changes.sources list a changed file or cite a changed symbol.rg (import statements and symbol names). Repeat on the files you find until you reach a page's sources or an entry point. Also check shared configuration that applies to many features without an import: middleware and route registration, dependency injection, environment and config files, lockfiles, and database migrations or schemas. Match pages whose depends_on list the changed file. Follow links from data-models/ and integrations/ pages to features.src/middleware/auth.ts → app.use(auth) in src/server.ts → /orders/:id/cancel), the requirements and scenarios at risk, and the tests to run.Done when: the report lists each directly and indirectly affected feature with its path, requirements, and tests to run, and the changed files that no page covers. Offer sync after the change merges.
Check the whole wiki and report each issue type:
HEAD, or cited symbols that rg cannot find.evidence.sh stale exits 1. List pages where it exits 3 separately, as incomplete checks, not as Stale.index.md, orphan pages, and broken wiki links.Ask before you fix anything. Append to log.md: ## [YYYY-MM-DD] lint | <short-sha> | <N> issues.
Done when: all six issue types are checked and reported with file and page references, and the log entry is appended.
Report:
HEAD (evidence.sh stale exits 1), and pages whose check is incomplete (exits 3), listed separately and not counted as currentevidence.sh checkpoint --wiki <wiki-dir>), how many commits HEAD is ahead of it, and any sync-partial ranges after itlog.mdDone when: all six items are reported.
human approves requirements → agent implements → independent agent evaluates requirements and tests
→ CI verifies → codebase-wiki sync/verify updates knowledge and evidence
→ human reviews behavior changes and open risks → releaseThe wiki does not approve requirements or releases. It records evidence and puts mismatches and risks in front of a human.
To keep the wiki current, run the agent with /codebase-wiki sync and /codebase-wiki lint on pushes to the default branch, then open a pull request with the wiki changes for human review. Run /codebase-wiki impact <PR> on pull requests and post the result as a comment. Use the agent CLI and credentials that the project already uses in CI. Do not commit wiki changes directly to the default branch.
The MVP uses only Markdown, Git, and the project's existing test runners. Do not add a vector database, graph database, MCP server, or web app.
jellydn/my-ai-tools
1524f4a
bunbun testevidence.shevidence.sh checkpointevidence.sh dirtyevidence.sh hashevidence.sh helpevidence.sh rangeevidence.sh staleghgh pr diffgitgit diffgit rev-parsegit showrgBunGitGitHub CLIripgrepshellAlso appears in
since Dec 2, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.