πŸ“š contextd

Write your team’s working rules once, so Claude can follow them from the start.

For every role Β· Start in ~5 minutes

View source and releases on GitHub

VIEN
βš™οΈ Install What is this? Get started Core concepts Command reference Workflows Packs FAQ
🏁 Setup 🧠 Daily use πŸ’Ό Non-tech πŸ”§ Solo πŸ“Š Report πŸ”¬ Evidence πŸ”­ Trace πŸš€ Bootstrap πŸ› Bug fix πŸ”§ Tool design
βš™οΈ Not installed yet? Open the install page first. Then come back and choose your role.

πŸ“– What is contextd?

A shared playbook for people and AI. Document how your team works in the wiki. AI reads it first and follows your standards.

🏒

Workspace

One company or project uses one workspace. Do not mix knowledge between workspaces.

πŸ“¦

Pack

A pack is a ready guide for one type of work (web-api, frontend-react, ai-app, product, and more).

πŸ“œ

Contract

A contract is a fixed format (API shape, data format, error code). Do not change it by yourself.

🧩

Pattern

A pattern is a recommended way to solve a common problem. Reuse it when possible.

🎯

Brief / OKR

Product briefs, goals, users, and metrics β€” non-technical product knowledge. Requires pack-product.

πŸ”

Evidence

Steps to turn notes into trusted wiki content: ingest β†’ analyze β†’ QA β†’ apply.

1Who are you?

Choose your role to see the simplest first steps.

πŸ’Ό

Non-technical (PM / Business / Product Owner)

You do not need to write code. You only need to describe goals, users, and product context.

Start here if you are in product/business
πŸ› οΈ

Engineer

You write code and want AI to follow your team’s contracts and patterns. You need wiki-aware code generation.

Start here if you write code
πŸ“š

Wiki Maintainer

You set up and maintain the team wiki β€” ingest knowledge, define rules, and keep wiki content aligned with real code.

Start here if you maintain the wiki
πŸ”§

Self-builder / Domain Expert

You work in another field (mechanical, accounting, healthcare, etc.) and use Claude Code as a self-builder tool to create apps that support your work.

Start here if you are not a developer but build your own tools

πŸ’Ό Guide for non-technical users

PM, Product Owner, Business Analyst, Stakeholder. No coding knowledge needed.

1

Ask your team for the workspace name

You do not need to create a workspace yourself. Just use your team’s workspace name. In Claude Code, run /list-workspaces to see all workspaces.

/list-workspaces
2

Need a simple explanation for technical terms?

If you see a term you do not know, run /contextd-explain topic. You will get a simple explanation with examples.

/contextd-explain circuit-breaker --depth tldr
/contextd-explain mqtt-topic-contract --depth short
3

Create your first product brief (guided prompts)

The system asks business questions: problem, users, success metrics, and timeline. No technical answers required.

/product-brief "Reduce signup friction for mobile users"

The result is saved automatically. You only need to fill remaining TODOs.

πŸ’‘ Next: When you need to explain a feature to leadership/business/customer support, run /business-view {service-name} β€” it outputs a plain-language document auto-synced with the engineering doc.

πŸ› οΈ Guide for Engineers

Backend / frontend / fullstack / mobile developers. You write code; AI reads the wiki first and generates code aligned with team rules.

1

Connect the wiki to your current codebase

First time in a new codebase: this command detects project name + tech stack and creates .claude/wiki.json connected to your workspace.

/contextd-setup

If the workspace does not exist yet, run /new-workspace project-name to create one.

2

Quickly find rules/contracts before coding

Use /find {keywords} to quickly locate rules in the wiki.

/find idempotency retry
/find rest error shape
3

Write wiki-aligned code for larger tasks

Before EVERY task (implement feature, fix bug, design, incident, review), run /use-contextd to run a pre-check workflow before coding and reduce mistakes.

/use-contextd implement payment refund flow with idempotency

Goal: keep code aligned with team agreements and avoid invented APIs.

πŸ’‘ Next: After code is merged, run /update-contextd to sync wiki updates. Run /rebase-contextd periodically to fix wiki/code drift.

πŸ“š Path for Wiki Maintainers

You set up wiki for a new team, or bootstrap a workspace from an existing codebase.

1

Create a new workspace

The wizard asks for metadata (company, role, period, stack, packs), then scaffolds full folders + workspace.md + an empty patterns-index.md.

/new-workspace acme-corp
2

Bootstrap knowledge from an existing codebase

If the team already has a legacy codebase, run /code-analyze to snapshot it β†’ the system proposes rules, contracts, and architecture from real code.

/code-analyze
/evidence-qa
/evidence-apply
3

Generate an overview report for the team

A self-contained HTML file covering the full workspace (Overview / Architecture / Contracts / Patterns / Domains / ADRs / Runbooks).

/contextd-report

Open the HTML file directly in a browser β€” no server required.

πŸ’‘ Next: Run /contextd-eval periodically to measure wiki quality (hallucination rate, knowledge gaps, plan-block rate). If you suspect drift, run /rebase-contextd.

πŸ”§ Guide for Self-builders / Domain Experts

You are a domain expert from another field (mechanical, accounting, healthcare, legal, education, etc.) using Claude Code as a personal builder assistant. You have ideas but need help starting.

1

Enable Solo Builder mode

Easiest way: run /tool-design directly β€” the system asks setup questions and enables the pack for you.

Manual way: run /contextd-setup β†’ in pack selection, tick pack-solo-builder.

To apply this for all projects in the workspace, edit workspace.md under ## Packs:

## Packs

- pack-solo-builder
2

Design your first tool from an idea

Unclear ideas are okay. The system asks 6-8 questions (each with examples + an "I don't know" option), draws a system map, checks existing tools to avoid duplicates, then recommends a suitable approach.

/tool-design "tool to calculate steel beam bending moment"
/tool-design "manage workshop component inventory"
/tool-design "pull USD/VND exchange rate every morning"

Result: a design spec with system map, chosen technology + rationale, setup guide for Linux and Windows, and acceptance criteria.

3

Turn the design into code

When the design spec is complete (no open questions), ask Claude Code to implement exactly from that spec:

implement spec at workspaces/{ws}/tools/{slug}-spec.md

Claude will implement according to the design spec β€” without changing technology choices on its own.

πŸ’‘ Next: Use /tool-list to review existing tools (avoid duplicates). Use /tool-extend tool-name to add features. On Windows, Claude may recommend Docker for complex setup.

2Core concepts (3-minute read)

Understanding these five concepts is enough for daily wiki usage.

Workspace (isolated knowledge base per company/project)
Each company/project gets its own workspace folder. Knowledge is never mixed across workspaces, because each organization has different rules. The active workspace is defined in .claude/wiki.json.
Pack (technology-specific knowledge bundle)
Wiki-template is stack-agnostic. Specialized knowledge (Kafka, REST, React, AI app, product, etc.) lives in packs. Enable/disable packs in /contextd-setup pack selection, or edit workspace.md. There are currently 13 packs (see section below).
Contract vs Pattern
Priority order: Contract > Pattern > Project docs > Domain knowledge. Contract = fixed agreement (API shape, data format) β€” must not be changed arbitrarily. Pattern = preferred implementation approach β€” should be reused, with exceptions only when justified.
Slash command vs internal workflow
Commands (/use-contextd, /find, ...) are what you invoke directly. Internal workflow (planner, context-selector, reviewer, ...) runs automatically in the background.
Evidence ingestion workflow
4 steps: /evidence-ingest β†’ /evidence-analyze β†’ /evidence-qa β†’ /evidence-apply. Use this when external sources (Confluence, Linear, pasted notes, code) need to be validated before entering the wiki. Raw source data remains immutable after ingest. Each workspace stays fully isolated.

3Command reference (cheat sheet)

Tags: tech for engineers Β· nontech no coding needed Β· maint for wiki maintainers.

🏁 Workspace setup & navigation

CommandPurposeWhen to use
/contextd-setuptechCreate .claude/wiki.json for the codebase, detect project name + componentsFirst time using wiki with a codebase
/contextd-detecttechValidate wiki.json, scan dependency, propose updateAfter setup, or when troubleshooting
/switch-workspace nametechSwitch the active workspace for the current codebaseOne codebase serving multiple domains
/new-workspace project-namemaintCreate a new workspace from templateJoining a new company/project
/list-workspacesnontechtechList all workspaces and highlight active oneCheck which workspaces exist

🧠 Wiki usage (per-task)

CommandPurposeWhen to use
/use-contextdtechLoad the right wiki context before Claude writes codeBefore each task: implement, bug fix, design, review
/find {keywords}techFind related rules and docs quicklyUse when you know the keyword but need the exact file
/update-contextdtechSave important code changes back to wikiRun after merge so wiki stays up to date
/rebase-contextdmaintCheck wiki against code and suggest fixesRun weekly/monthly, or when wiki looks outdated

πŸ’Ό Non-tech contributors (Product / Business)

CommandPurposeWhen to use
/product-brief [title]nontechGuide to create product brief: Problem / Users / Success metrics / Acceptance criteriaWhen PM creates a new brief before handing off to engineering
/business-view {target}nontechTranslate technical docs into plain business languageExplain features to leadership/business/support
/contextd-explain topicnontechExplain a term/rule in plain languageWhen you hit unfamiliar terms while reading wiki
Requirement: Workspace must enable pack-product β€” easiest path: run /contextd-setup Step 4.5 and tick pack-product. Or run /product-brief and let it guide enabling.

πŸ”§ Solo builder (Non-tech experts using Claude Code as a no-code IDE)

CommandPurposeWhen to use
/tool-design "idea"nontechDiscovery wizard β†’ system map β†’ recipe match β†’ recommended stack β†’ write spec (NO code generation)When you have a new tool idea but do not know where to start
/tool-listnontechList created tools grouped by statusCheck existing tools before creating new ones (avoid duplicates)
/tool-extend tool-namenontechPropose upgrades for existing tools β€” add features, adjust scopeWhen an existing tool needs enhancements
Requirement: Workspace enables pack-solo-builder (slash /tool-design can enable it). Cross-platform recipes: Linux native + Docker recommendation on Windows for complex dependencies.

πŸ“Š Reporting

CommandPurposeWhen to use
/contextd-reportmaintSingle standalone HTML file β€” Overview / Architecture / Contracts / Patterns / RunbooksOnboard new members, periodic reporting, gap review

πŸ”¬ Codebase analysis & evidence pipeline

CommandPurposeWhen to use
/code-analyzemaintAnalyze codebase β†’ propose rules/contracts/architecture from real codeBootstrap old codebases, or refresh after major changes
/evidence-ingestmaintPull raw data from MCP / API / paste / code into evidence/sources/{id}/When external sources need to be ingested
/obsidian-ingestmaintBatch ingest from Obsidian vault: scan, deduplicate, pre-check before ingestMaintain your Obsidian Second Brain
/evidence-analyzemaintAnalyze ingested dataAfter ingestion
/evidence-qamaintQ&A loop with user, generate verified-facts.mdAfter analysis, verify before apply
/evidence-applymaintApply verified facts to wikiAfter verification

πŸ”­ Pipeline observability

CommandPurposeWhen to use
/contextd-trace {run_id}maintRender Markdown timeline 1 run pipeline (4 stage)When /use-contextd output is wrong β€” debug stage divergence
/contextd-evalmaintMetrics: hallucination rate, knowledge gaps, violation scorePeriodic wiki quality check
/contextd-vizmaintHTML viewer + live trace watchVisual inspection

4Workflows that combine commands

Three real-world recipes β€” what becomes possible when commands chain together.

πŸš€ Bootstrap a legacy codebase in 30 minutes

Scenario: Inherit an undocumented codebase, need a wiki + shareable report for the team.

/new-workspace acme-corp        # Create workspace shell
       ↓
/code-analyze                    # Snapshot real code β†’ propose rules & contracts
       ↓
/evidence-qa                     # Verify proposed facts (Y/N per item)
       ↓
/evidence-apply                  # Write verified facts into wiki
       ↓
/contextd-report                 # Generate standalone HTML overview

Outcome: Wiki populated from real code + self-contained HTML report to share with the whole team. No more "where do I start?" for new hires.

πŸ› Safe bug fix on Friday at 5pm

Scenario: Production duplicate-charge bug. You need a fix that respects your team's retry/idempotency rules β€” not what AI guesses.

/find "idempotency retry"        # Locate the relevant pattern in seconds
       ↓
/use-contextd "fix duplicate refund in payment flow"
       ↓     (planner β†’ context β†’ builder β†’ reviewer β€” 4-stage pipeline)
   Claude writes code that follows the retrieved contract
       ↓
/update-contextd                  # Sync changed code back into the wiki

Outcome: Fix that follows team rules, wiki stays in sync after merge β€” no drift between code and docs.

πŸ”§ Solo builder: idea β†’ running tool

Scenario: You're a domain expert (mechanical, accounting, healthcare, ...). You have an idea but don't know the tech stack.

/tool-design "calculate steel beam bending moment"
       ↓     (6-8 guided questions, each with examples + "I don't know" option)
   Spec saved β†’ workspaces/{ws}/tools/{slug}-spec.md
       ↓
implement spec at workspaces/{ws}/tools/{slug}-spec.md
       ↓     (Claude implements faithfully β€” no stack drift)
/tool-list                        # See your toolbox grouped by status
       ↓
/tool-extend tool-name            # Add features later without rewriting

Outcome: A working tool + setup guide for Linux & Windows + a record in your toolbox.

5Available packs

Enable packs via /contextd-setup Step 4.5 (per-codebase checkbox UI, saved in wiki.json#packs) β€” or edit workspaces/{ws}/workspace.md under ## Packs (workspace-wide default).

PackStatusUse for
pack-event-drivenstableEvent processing: Kafka, MQTT, RabbitMQ β€” retries, DLQ handling
pack-web-apistableWeb APIs: REST/GraphQL/gRPC β€” input validation, error shape, no information leakage
pack-frontend-reactstableReact + Next.js β€” hooks rules, a11y, effect cleanup, list keys, server/client boundary
pack-ui-uxbeta v0.1UI/UX design β€” design system, design tokens, WCAG 2.1 AA accessibility, user flows, UX writing. Pairs with pack-frontend-react (design doc ↔ code impl)
pack-ai-appstableAI apps: prompt caching, structured output, testing, privacy safety
pack-agenticstableAI agents: loops, tool use, multi-agent orchestration β€” bounded steps, safe retries
pack-claude-plugin-devstableClaude Code plugin development β€” commands, subagents, skills, hooks
pack-productbetaProduct docs for PM/business β€” briefs, OKRs, roadmap, personas, metrics
pack-solo-builderbetaFor non-tech domain experts (mechanical, accounting, ...) using Claude Code as a "no-code IDE" β€” tool-design coach + cross-platform recipe library
pack-babetaBusiness analysis β€” requirements modeling, acceptance criteria, process mapping, stakeholder alignment
pack-qcbeta v0.2Quality control + performance optimization (absorbs pack-optimize) β€” test design/execution, defect triage, regression, release gates, baseline metrics, profiling, regression guards
pack-securitybeta v0.2Security engineering + authorized pentest (absorbs pack-pentest) β€” threat modeling, secure design reviews, scope discipline, evidence-based findings, risk rating, remediation
pack-dbabetaDBA workflow β€” schema change safety, query hygiene, backup/restore readiness, operational guardrails

Example combinations: Solo fullstack β†’ pack-web-api + pack-frontend-react + pack-ai-app. AI agent product β†’ pack-ai-app + pack-agentic + pack-web-api + pack-frontend-react. Team with PMs β†’ add pack-product.

6FAQ

I do not code β€” can I still use this wiki?

Yes β€” two paths depending on your role:

If you are PM/business in a team with engineers: enable pack-product, then use:

  • /product-brief β€” create a new brief
  • /business-view {service} β€” read service docs in business language
  • /contextd-explain topic β€” explain technical terms

If you are a domain expert (mechanical, accounting, healthcare, ... ) building your own tools: enable pack-solo-builder, then use:

  • /tool-design "idea" β€” wizard discovery + recommend tech stack
  • /tool-list β€” view existing toolbox
  • /tool-extend tool-name β€” extend an existing tool

You do not need git, terminal expertise, or coding. You only need to run commands in Claude Code.

I work across multiple companies/projects β€” can I use one wiki template?

Yes. Each company/project has its own workspace under workspaces/{name}/.

Create one: /new-workspace project-name. Switch one: /switch-workspace name.

Wiki and code drift β€” how do I sync?

Use two commands:

  • /update-contextd β€” run after each merge
  • /rebase-contextd β€” run regularly for a full check

Use /contextd-eval to see quality metrics and missing knowledge.

When should I use packs (and when not)?

Use packs for stack-specific knowledge (e.g. Kafka rules, React hooks rules). Enable via /contextd-setup Step 4.5.

Do NOT use packs for rules specific to your workspace β€” write them in workspaces/{ws}/agents/constraints.md with prefix ws-.

Engine-wide rules (all workspaces, stack-agnostic) belong in agents/constraints.md.

One workspace, multiple codebases, different pack needs β€” how?

Use per-codebase override via .claude/wiki.json#packs:

  • Workspace default: workspaces/acme-corp/workspace.md ## Packs = [pack-event-driven, pack-web-api]
  • Frontend codebase: acme-frontend/.claude/wiki.json sets "packs": ["pack-frontend-react", "pack-web-api"] β†’ effective packs are frontend + web-api only
  • Backend codebase (no override) β†’ effective packs = workspace default

Replace semantics, not additive. null/missing field follows workspace default. Array fully overrides.

Easiest way: run /contextd-setup in the codebase β†’ Step 4.5 shows all pack checkboxes and writes wiki.json automatically.

There are too many slash commands β€” do I need all of them?

No. Most people only need 3-4 commands:

  • Daily engineering: /use-contextd, /find, /update-contextd
  • Daily non-tech: /product-brief, /business-view, /contextd-explain
  • One-time setup: /contextd-setup or /new-workspace

Learn the others only when you need them.

Where is my workspace stored?

Default path is {wiki-template-root}/workspaces/{name}/. You can override it with wiki_root in ~/.claude/wiki-global.json. To see active path: use /list-workspaces or read <cwd>/.claude/wiki.json.

Can AI hallucinate knowledge not in the wiki?

The system enforces strict rules: if knowledge is missing, AI must report assumptions or constraint conflicts, not invent facts. A validator (scripts/validate.py) checks common violation patterns. For monitoring: /contextd-eval reports hallucination rate per run.

I want a new pack for a custom stack (e.g. Flutter) β€” how?

Run pack scaffold command:

python scripts/scaffold-pack.py pack-mobile-flutter

This generates 8 skeleton files. Customize pack.yaml components + keywords, write constraints.md, and add rules in scripts/rules.py. Register it in catalog: edit packs/README.md.