···19192020- new files should be in kebab-case
2121- use tabs for indentation, spaces allowed for diagrams in comments
2222-- use single quotes and add trailing commas
2222+- use single quotes for strings; use template literals for localization strings (user-facing
2323+ strings, error messages)
2424+- add trailing commas
2325- prefer arrow functions, but use regular methods in classes unless arrow functions are necessary
2426 (e.g., when passing the method as a callback that needs `this` binding)
2527- use braces for control statements, even single-line bodies
2628- use bare blocks `{ }` to group related code and limit variable scope
2727-- use template literals for user-facing strings and error messages
2829- avoid barrel exports (index files that re-export from other modules); import directly from source
2930- use `// #region <name>` and `// #endregion` to denote regions when a file needs to contain a lot
3031 of code
3131-- prefer required parameters over optional ones; optional parameters are acceptable when:
3232- - the default is obvious and used by the vast majority of callers (e.g., `encoding = 'utf-8'`)
3333- - it's a configuration value with a sensible default (e.g., `timeout = 5000`)
3232+- a parameter should be optional only when callers genuinely split between passing a value and
3333+ relying on the default; if every caller passes a value, make it required; if no caller would ever
3434+ change it, it should not be a parameter at all
3435- avoid optional parameters that change behavioral modes or make the function do different things
3535- based on presence/absence; prefer separate functions instead
3636-- when adding optional parameters for backwards compatibility, consider whether a new function with
3737- a clearer name would be better
3636+ based on presence/absence; prefer a separate function with a clearer name instead
3737+- avoid type assertions (`as Type`, `as const`) unless TypeScript actually errors without them; when
3838+ it does error, prefer finding a solution that satisfies the type system naturally before resorting
3939+ to an assertion
38403941### documentation
4042···6163 pause and ask for clarification when you're still unsure after looking into it
6264- in plan mode, present the plan for review before exiting to allow for feedback or follow-up
6365 questions
6464-- when debugging problems, isolate the root cause first before attempting fixes: add logging,
6565- reproduce the issue, narrow down the scope, and confirm the exact source of the problem
6666+- when debugging problems, isolate the root cause first before attempting fixes; suggest adding
6767+ logging and let the user reproduce and share the output, unless you can verify directly (e.g., by
6868+ running tests or reading existing error output)
66696770### Claude Code-specific
68716969-- Explore tool (subagents for exploration, planning, etc.) may not always be accurate; verify
7070- subagent findings when needed
7171-7272-### cgr
7373-7474-use `@oomfware/cgr` to ask questions about external repositories.
7575-7676-```
7777-npx @oomfware/cgr ask [options] <repo>[#branch] <question>
7878-7979-options:
8080- -m, --model <model> model to use: opus, sonnet, haiku (default: haiku)
8181- -d, --deep clone full history (enables git log/blame/show)
8282- -w, --with <repo> additional repository to include, supports #branch (repeatable)
8383-```
8484-8585-useful repositories:
8686-8787-- `github.com/bluesky-social/atproto` for AT Protocol reference implementation, lexicons, XRPC
8888-- `github.com/ascorbic/cirrus` for TypeScript PDS on Cloudflare Workers, @atcute usage patterns
8989-- `github.com/haileyok/cocoon` for Go PDS implementation
9090-- `github.com/davidbuchanan314/millipds` for Python PDS implementation
9191-- `github.com/davidbuchanan314/atmst` for MST internals (Python)
9292-- `tangled.org/futur.blue/pegasus` for OCaml PDS + atproto libraries
9393-- `tangled.org/tranquil.farm/tranquil-pds` for Rust PDS implementation
9494-9595-broad questions work for getting oriented; detailed questions get precise answers. include
9696-file/folder paths when you know them, and reference details from previous answers in follow-ups.
9797-9898-run `npx @oomfware/cgr --help` for more options.
9999-100100-## Decision Graph Workflow
101101-102102-**THIS IS MANDATORY. Log decisions IN REAL-TIME, not retroactively.**
103103-104104-### The Core Rule
105105-106106-```
107107-BEFORE you do something -> Log what you're ABOUT to do
108108-AFTER it succeeds/fails -> Log the outcome
109109-CONNECT immediately -> Link every node to its parent
110110-AUDIT regularly -> Check for missing connections
111111-```
112112-113113-### Behavioral Triggers - MUST LOG WHEN:
114114-115115-| Trigger | Log Type | Example |
116116-| ---------------------------- | ------------------ | ------------------------------ |
117117-| User asks for a new feature | `goal` **with -p** | "Add dark mode" |
118118-| Choosing between approaches | `decision` | "Choose state management" |
119119-| About to write/edit code | `action` | "Implementing Redux store" |
120120-| Something worked or failed | `outcome` | "Redux integration successful" |
121121-| Notice something interesting | `observation` | "Existing code uses hooks" |
122122-123123-### CRITICAL: Capture VERBATIM User Prompts
124124-125125-**Prompts must be the EXACT user message, not a summary.** When a user request triggers new work,
126126-capture their full message word-for-word.
127127-128128-**BAD - summaries are useless for context recovery:**
129129-130130-```bash
131131-# DON'T DO THIS - this is a summary, not a prompt
132132-deciduous add goal "Add auth" -p "User asked: add login to the app"
133133-```
134134-135135-**GOOD - verbatim prompts enable full context recovery:**
136136-137137-```bash
138138-# Use --prompt-stdin for multi-line prompts
139139-deciduous add goal "Add auth" -c 90 --prompt-stdin << 'EOF'
140140-I need to add user authentication to the app. Users should be able to sign up
141141-with email/password, and we need OAuth support for Google and GitHub. The auth
142142-should use JWT tokens with refresh token rotation.
143143-EOF
144144-145145-# Or use the prompt command to update existing nodes
146146-deciduous prompt 42 << 'EOF'
147147-The full verbatim user message goes here...
148148-EOF
149149-```
150150-151151-**When to capture prompts:**
152152-153153-- Root `goal` nodes: YES - the FULL original request
154154-- Major direction changes: YES - when user redirects the work
155155-- Routine downstream nodes: NO - they inherit context via edges
156156-157157-**Updating prompts on existing nodes:**
158158-159159-```bash
160160-deciduous prompt <node_id> "full verbatim prompt here"
161161-cat prompt.txt | deciduous prompt <node_id> # Multi-line from stdin
162162-```
163163-164164-Prompts are viewable in the TUI detail panel (`deciduous tui`) and web viewer.
165165-166166-### ⚠️ CRITICAL: Maintain Connections
167167-168168-**The graph's value is in its CONNECTIONS, not just nodes.**
169169-170170-| When you create... | IMMEDIATELY link to... |
171171-| ------------------ | --------------------------------- |
172172-| `outcome` | The action/goal it resolves |
173173-| `action` | The goal/decision that spawned it |
174174-| `option` | Its parent decision |
175175-| `observation` | Related goal/action |
176176-177177-**Root `goal` nodes are the ONLY valid orphans.**
178178-179179-### Quick Commands
180180-181181-```bash
182182-deciduous add goal "Title" -c 90 -p "User's original request"
183183-deciduous add action "Title" -c 85
184184-deciduous link FROM TO -r "reason" # DO THIS IMMEDIATELY!
185185-deciduous serve # View live (auto-refreshes every 30s)
186186-deciduous sync # Export for static hosting
187187-188188-# Metadata flags
189189-# -c, --confidence 0-100 Confidence level
190190-# -p, --prompt "..." Store the user prompt (use when semantically meaningful)
191191-# -f, --files "a.rs,b.rs" Associate files
192192-# -b, --branch <name> Git branch (auto-detected)
193193-# --commit <hash|HEAD> Link to git commit (use HEAD for current commit)
194194-195195-# Branch filtering
196196-deciduous nodes --branch main
197197-deciduous nodes -b feature-auth
198198-```
199199-200200-### ⚠️ CRITICAL: Link Commits to Actions/Outcomes
201201-202202-**After every git commit, link it to the decision graph!**
203203-204204-```bash
205205-git commit -m "feat: add auth"
206206-deciduous add action "Implemented auth" -c 90 --commit HEAD
207207-deciduous link <goal_id> <action_id> -r "Implementation"
208208-```
209209-210210-The `--commit HEAD` flag captures the commit hash and links it to the node. The web viewer will show
211211-commit messages, authors, and dates.
212212-213213-### Git History & Deployment
214214-215215-```bash
216216-# Export graph AND git history for web viewer
217217-deciduous sync
218218-219219-# This creates:
220220-# - docs/graph-data.json (decision graph)
221221-# - docs/git-history.json (commit info for linked nodes)
222222-```
223223-224224-To deploy to GitHub Pages:
225225-226226-1. `deciduous sync` to export
227227-2. Push to GitHub
228228-3. Settings > Pages > Deploy from branch > /docs folder
229229-230230-Your graph will be live at `https://<user>.github.io/<repo>/`
231231-232232-### Branch-Based Grouping
233233-234234-Nodes are auto-tagged with the current git branch. Configure in `.deciduous/config.toml`:
235235-236236-```toml
237237-[branch]
238238-main_branches = ["main", "master"]
239239-auto_detect = true
240240-```
241241-242242-### Audit Checklist (Before Every Sync)
243243-244244-1. Does every **outcome** link back to what caused it?
245245-2. Does every **action** link to why you did it?
246246-3. Any **dangling outcomes** without parents?
247247-248248-### Session Start Checklist
249249-250250-```bash
251251-deciduous nodes # What decisions exist?
252252-deciduous edges # How are they connected? Any gaps?
253253-git status # Current state
254254-```
255255-256256-### Multi-User Sync
257257-258258-Share decisions across teammates:
259259-260260-```bash
261261-# Export your branch's decisions
262262-deciduous diff export --branch feature-x -o .deciduous/patches/my-feature.json
263263-264264-# Apply patches from teammates (idempotent)
265265-deciduous diff apply .deciduous/patches/*.json
266266-267267-# Preview before applying
268268-deciduous diff apply --dry-run .deciduous/patches/teammate.json
269269-```
270270-271271-PR workflow: Export patch → commit patch file → PR → teammates apply.
7272+- Explore subagent may not be accurate; verify findings as needed
7373+- only spawn subagents when there is genuine independent work to parallelize (e.g. searching across
7474+ many files, answering a question requiring broad exploration.) never use them as file I/O proxies
7575+ — read files directly in the main context, and prefer direct tool calls when they suffice.