<codefidence/>

Getting Started

Get from zero to a working wiki in about 25 minutes. Each phase builds on the previous one, and you can stop at any point and resume later.

Prerequisites

Install codefidence using your preferred package manager:

bash
$ npm install -g @agence-debord/codefidence

Or via Homebrew:

bash
$ brew install agencedebord/tap/codefidence

Or build from source with Cargo:

bash
$ cargo install codefidence

Phase 1: Bootstrap (5 min)

Run the init command with the --scan flag to create the .wiki/ directory and let codefidence discover your project's domains:

bash
$ codefidence init --scan

✔ Created .wiki/ directory
✔ Scanned project structure
✔ Discovered 4 domains: auth, billing, notifications, users
✔ Generated domain notes with initial candidates

This creates a .wiki/ directory at the root of your project. Each discovered domain gets its own YAML file with scaffolded notes.

Phase 2: Generate and Review Candidates (10 min)

Run the candidate generator to have codefidence analyze your source code and propose memory items:

bash
$ codefidence generate-candidates

✔ Analyzed 47 files
✔ Generated 12 candidate memory items
✔ Written to .wiki/_candidates.md

Open _candidates.md and review each proposed item. Candidates are suggestions, not facts. Your job is to validate, adjust, or discard them.

Phase 3: Curate First Memory Items (5 min)

Promote the best candidates into real memory items:

bash
$ codefidence promote candidate-3
✔ Promoted "Stripe webhook signature validation" to auth domain

Focus on items that match these types:

Type What it captures Example
exception The most dangerous gotchas "Never call processPayment twice for the same order"
decision Architectural choices and their rationale "We use event sourcing for the billing domain because..."
business_rule Domain logic that is not obvious from the code "Free-tier users get 3 projects max, enforced in ProjectService"

Phase 4: Verify the Loop (2 min)

Test that the read-write-check cycle works. These are the three core commands you will use daily:

bash
# Surface context before editing a file
$ codefidence context src/billing/checkout.ts

# After making changes, check your diff against the wiki
$ codefidence check-diff

# Validate all memory items are still consistent
$ codefidence validate

Phase 5: Install Hooks (optional)

If you use Claude Code, install the hooks so context is surfaced automatically:

bash
$ codefidence init --hooks

✔ Installed PreToolUse hook (context --hook)
✔ Installed PostToolUse hook (detect-drift --hook)
✔ Patched CLAUDE.md with wiki instructions

With hooks installed, the PreToolUse hook runs context --hook before every file edit, and the PostToolUse hook runs detect-drift --hook after every file write.

What NOT to Do First

  • Don't try to document everything at once. Start with 3-5 memory items in one domain.
  • Don't install hooks before you have useful items. Hooks with an empty wiki add noise.
  • Don't skip the review step. Candidates generated from code analysis may contain inaccuracies.
  • Don't treat the wiki as a source of truth. If the wiki contradicts the code, the code wins.

Recommended Pace

Week Goal
Week 1 Init + scan. Promote 3-5 items in your most critical domain.
Week 2 Add a second domain. Run check-diff on every PR.
Week 3 Install hooks if using Claude Code. Start confirming items from code reviews.
Week 4+ Organic growth. Add items as you discover new knowledge during development.