# Document Mode

Use document mode when knowledge should persist beyond the chat. Prefer updating existing pages over creating duplicates.

## Workflow

1. Search first.
   - Read `llm-wiki/wiki/index.md` and relevant pages.
   - Use `rg` or `llm-wiki context "<topic>" --workspace <project>` to find existing material.

2. Pick the right location.
   - Reusable architecture: `llm-wiki/wiki/architecture/`.
   - Debugging root cause/fix: `llm-wiki/wiki/debugging/`.
   - Decisions and rationale: `llm-wiki/wiki/decisions/`.
   - Concepts, systems, tools, and conventions: `llm-wiki/wiki/concepts/` or `procedures/`.
   - Requested long reports: `llm-wiki/outputs/reports/`.
   - One-off live Q&A: `llm-wiki/outputs/questions/`.

3. Write with evidence.
   - Every curated page MUST include the required core frontmatter `title`, `type`, `status`, `memory_type`, `last_updated`, **and `keywords`**. Durable types (decision, architecture, procedure, concept, debugging) lint-error on missing `keywords`; every other type lint-warns. `keywords` carries a 2.2x search boost, so a page without it is nearly invisible to retrieval — fill it on creation, do not leave it for later.
   - Fill the recommended fields too, not only the required minimum: `description`, `aliases`, `importance`, `confidence`, `last_verified`, and `evidence_refs` (when claims matter). Put project-specific metadata under `extensions` with lowercase snake_case keys.
   - Start from this complete template so no field is missed (drop the `# ...` placeholder body, replace values):

     ```yaml
     ---
     title: "Human-readable page title"
     type: "decision"              # source | concept | decision | architecture | debugging | context | query | session-log | convention | procedure | report | entity
     status: "draft"               # draft | reviewed | stale | archived
     memory_type: "semantic"       # semantic | episodic | procedural
     last_updated: "2026-07-31"
     description: "One-line summary used by search and context ranking."
     aliases: []
     keywords: [term1, term2, 배포] # 3-8 search-optimized concept terms; required on durable types
     importance: 3                 # 1-5; reserve 5 for pages that must outrank peers
     confidence: "medium"          # high | medium | low
     last_verified: "unknown"      # YYYY-MM-DD | unknown
     evidence_refs: []             # cmd:... | file:... pointing at proof
     ---
     ```

   - When claims, decisions, procedures, or active guidance change, update `last_updated` in the same edit. Revise `last_verified`, `confidence`, `status`, and `evidence_refs` when their meaning changed; formatting-only work is not re-verification.
   - Separate verified facts from inference.
   - Include file paths, commands, or `evidence_refs` when claims matter.
   - Update `llm-wiki/wiki/index.md` when adding an important entry point.

4. Run the batched lint gate.
   - The kit counts durable `llm-wiki/wiki/**/*.md` and `llm-wiki/procedures/**/*.md` page changes since the last corpus lint and prompts after N changes (default 10, configurable via `lintBatchThreshold` in `.kit-state.json`). Run `llm-wiki lint --workspace <project>` when prompted, or before reporting the documentation task complete. A corpus lint resets the counter.
   - The document set is **not complete** until the corpus lint reports zero errors (warnings are advisory unless `--fail-on-warning` is passed).
   - `llm-wiki lint <file> --workspace <project> --fail-on-warning --suppress-auto-fixable` is still available as an on-demand single-file spot-check, but is no longer required after every write.

## Safety

- Never store credentials, tokens, private keys, raw `.env`, personal data, contracts, invoices, or financial details.
- Redact sensitive command output before saving.
- Preserve contradictions in `Contradictions` or `Open Questions`; do not overwrite history silently.
