Updating Knowledge
Update Knowledge
Keep project documentation synchronized with code changes. The code has already changed; this skill detects what the change affected and updates the knowledge base accordingly — nothing more. It never modifies application source code, never refactors, never fixes bugs, and never touches documents the change did not affect. This skill implements Phase 5 (Documentation Updates) of the project's AGENTS.md.
This skill does exactly one thing: align engineering-knowledge/ with code that already changed.
In scope:
- Reading git diffs to determine what changed.
- Updating knowledge-base documents whose subject matter was directly touched by the diff.
- Appending a changelog entry.
Out of scope — do not do these even if tempting:
- Do not edit, refactor, or "fix" application source code.
- Do not update documents unrelated to the diff, even if they look stale, wrong, or incomplete. Note staleness you notice but didn't cause as a separate "unrelated observation" in the changelog — do not fix it.
- Do not regenerate or rewrite entire documents from scratch when a targeted edit suffices.
- Do not restructure the knowledge-base folder layout, renaming/merging docs, unless the code change itself removed/renamed the thing a doc describes.
- Do not run the full
bootstrap-projectskill yourself — only recommend it when a gap is found. - Do not speculate about future changes, roadmap items, or TODOs not reflected in the diff.
- Do not add documentation for planned-but-unimplemented code.
If you find yourself about to touch a file not mapped to the diff in Steps 2–5, stop and don't.
- Change scope: uncommitted working tree, staged changes, a commit range, a branch diff, or a PR reference. Default: uncommitted + staged changes; if the working tree is clean, the most recent commit.
Progress:
- Step 1: Analyze git changes
- Step 2: Identify impacted APIs
- Step 3: Identify impacted business rules
- Step 4: Identify impacted database structures
- Step 5: Identify impacted service interactions
- Step 6: Update knowledge base documents (affected only)
- Step 7: Generate documentation changelog
Step 1 — Analyze git changes
- Resolve the change scope (
git status,git diff,git diff <range>,git show). - List changed files and classify each: source code, schema/migration, API definition, configuration, tests, or documentation.
- Determine which files carry documentation impact. Files with no documentation impact are not analyzed further, but are recorded as "reviewed — no documentation impact" in the changelog.
- Build an explicit impact map before editing anything:
changed file → candidate doc(s) → reason. This map is the only allow-list of documents you may touch in Step 6.
Step 2 — Identify impacted APIs
- Map changed route handlers, RPC/service definitions, controllers, and shared-library signatures to entries in
engineering-knowledge/api/. - New endpoints → add catalog entries (method, path, handler
file:line, schemas, auth requirement). - Changed contracts → update request/response schemas, error codes, versioning, and deprecation notices.
- Removed endpoints → mark as removed with the removal commit and replacement path.
- Do not touch API docs for endpoints the diff didn't change.
Step 3 — Identify impacted business rules
- Map changed validation, state-transition, calculation, workflow, and authorization logic to rule entries in
engineering-knowledge/business-rules/. - Update each affected rule's statement and enforcement location (
file:line); add rules introduced by the change; mark rules removed or superseded. - Do not reinterpret or "improve" rule wording beyond what the code change requires.
Step 4 — Identify impacted database structures
- Map changed ORM models/entities, schema definitions, and migration files to documents in
engineering-knowledge/data/. - Update table/collection purpose, columns, relationships, indexes, constraints, and per-service read/write ownership to match the new schema state.
- Do not document tables/columns unaffected by the current migration or model diff.
Step 5 — Identify impacted service interactions
- Map changed message topics/events, RPC clients, HTTP client calls, and dependency configuration to
engineering-knowledge/services/andengineering-knowledge/architecture/. - Update service descriptions, dependency graphs, sequence flows, and deployment topology where interactions changed.
- Do not redraw diagrams beyond the edges/nodes actually affected.
Step 6 — Update knowledge base documents
- Update only documents present in the Step 1 impact map. A document with no impact must not be opened for editing.
- Use the smallest possible edit: change the specific section/field, not the whole document.
- Keep cross-links consistent: services ↔ repositories ↔ APIs ↔ tables ↔ rules ↔ diagrams — but only links touching the changed entries.
- Update the knowledge-base index
README.mdonly when documents are added, removed, or renamed. - Cite evidence (
file:line, commit hashes) for every update; mark any unverified inference with Assumption: for human review. - If changed code has no corresponding documentation at all, note the gap in the changelog and recommend running the
bootstrap-projectskill — do not create the missing document structure yourself.
Step 7 — Generate documentation changelog
- Append to (or create)
engineering-knowledge/CHANGELOG.md:- Date and change scope (branch, commit range, or PR).
- One entry per updated document: what changed and why, referencing the originating commits/files.
- Entries for reviewed items with no documentation impact.
- Any gaps found (undocumented code) flagged for follow-up.
- Any unrelated staleness noticed but deliberately not fixed, flagged for separate follow-up.
Example 1:
Input: Commit adds a new DELETE /orders/:id endpoint and a cancelled_at column on orders.
Output: engineering-knowledge/api/orders.md gets a new endpoint entry; engineering-knowledge/data/orders.md gets the new column documented; CHANGELOG.md gets one entry for each file plus a note that business-rules/ and services/ were reviewed with no impact found.
Example 2:
Input: Commit only renames a local variable inside a function, no signature/behavior change.
Output: No knowledge-base document is edited. CHANGELOG.md records "reviewed — no documentation impact" for that file.
- Build the impact map first; treat it as a hard allow-list for edits.
- Prefer surgical diffs to documentation files over full rewrites.
- Always cite
file:lineor commit hash as evidence for a doc change. - Flag uncertainty explicitly with Assumption: rather than guessing silently.
- Keep the changelog entry 1:1 with what was actually edited — no more, no less.
- Rewriting an entire document when only one field changed.
- "Helpfully" fixing unrelated stale or incorrect documentation in the same pass.
- Creating new knowledge-base folder structure instead of recommending
bootstrap-project. - Skipping the changelog entry for files reviewed and found to have no impact.
- Updating cross-linked documents that share a topic but weren't actually touched by the diff.