···11+# Project Subagents Configuration
22+# Domain-specific agents for working on different parts of the codebase.
33+#
44+# When working on a specific domain, spawn a Task with subagent_type="Explore" or
55+# "general-purpose" and include the relevant agent's context in the prompt.
66+#
77+# Customize this file for YOUR project's structure. The domains below are examples.
88+99+# Example: Backend/Core agent
1010+# [agents.backend]
1111+# name = "Backend Agent"
1212+# description = "API routes, database models, business logic"
1313+# file_patterns = [
1414+# "src/**/*.rs",
1515+# "src/**/*.py",
1616+# "app/**/*.py"
1717+# ]
1818+# focus_areas = [
1919+# "Database operations",
2020+# "API endpoints",
2121+# "Business logic"
2222+# ]
2323+# instructions = """
2424+# When working on backend:
2525+# - Run tests before and after changes
2626+# - Follow existing patterns for new endpoints
2727+# - Maintain backwards compatibility
2828+# """
2929+3030+# Example: Frontend agent
3131+# [agents.frontend]
3232+# name = "Frontend Agent"
3333+# description = "UI components, state management, styling"
3434+# file_patterns = [
3535+# "web/src/**/*.ts",
3636+# "web/src/**/*.tsx",
3737+# "src/components/**"
3838+# ]
3939+# focus_areas = [
4040+# "React components",
4141+# "State management",
4242+# "Styling and layout"
4343+# ]
4444+# instructions = """
4545+# When working on frontend:
4646+# - Test in browser after changes
4747+# - Follow component patterns
4848+# - Keep accessibility in mind
4949+# """
5050+5151+# Example: Infrastructure agent
5252+# [agents.infra]
5353+# name = "Infrastructure Agent"
5454+# description = "CI/CD, deployment, configuration"
5555+# file_patterns = [
5656+# ".github/workflows/**",
5757+# "Dockerfile",
5858+# "docker-compose.yml",
5959+# "scripts/**"
6060+# ]
6161+# focus_areas = [
6262+# "GitHub Actions",
6363+# "Docker configuration",
6464+# "Deployment scripts"
6565+# ]
6666+# instructions = """
6767+# When working on infrastructure:
6868+# - Test workflows locally when possible
6969+# - Keep builds fast with caching
7070+# - Document any manual steps
7171+# """
+195
.claude/commands/context.md
···11+---
22+description: Recover context from decision graph and recent activity - USE THIS ON SESSION START
33+allowed-tools: Bash(deciduous:*, git:*, cat:*, tail:*)
44+argument-hint: [focus-area]
55+---
66+77+# Context Recovery
88+99+**RUN THIS AT SESSION START.** The decision graph is your persistent memory.
1010+1111+## Step 1: Query the Graph
1212+1313+```bash
1414+# See all decisions (look for recent ones and pending status)
1515+deciduous nodes
1616+1717+# Filter by current branch (useful for feature work)
1818+deciduous nodes --branch $(git rev-parse --abbrev-ref HEAD)
1919+2020+# See how decisions connect
2121+deciduous edges
2222+2323+# What commands were recently run?
2424+deciduous commands
2525+```
2626+2727+**Branch-scoped context**: If working on a feature branch, filter nodes to see only decisions relevant to this branch. Main branch nodes are tagged with `[branch: main]`.
2828+2929+## Step 1.5: Audit Graph Integrity
3030+3131+**CRITICAL: Check that all nodes are logically connected.**
3232+3333+```bash
3434+# Find nodes with no incoming edges (potential missing connections)
3535+deciduous edges | cut -d'>' -f2 | cut -d' ' -f2 | sort -u > /tmp/has_parent.txt
3636+deciduous nodes | tail -n+3 | awk '{print $1}' | while read id; do
3737+ grep -q "^$id$" /tmp/has_parent.txt || echo "CHECK: $id"
3838+done
3939+```
4040+4141+**Review each flagged node:**
4242+4343+- Root `goal` nodes are VALID without parents
4444+- `outcome` nodes MUST link back to their action/goal
4545+- `action` nodes MUST link to their parent goal/decision
4646+- `option` nodes MUST link to their parent decision
4747+4848+**Fix missing connections:**
4949+5050+```bash
5151+deciduous link <parent_id> <child_id> -r "Retroactive connection - <reason>"
5252+```
5353+5454+## Step 2: Check Git State
5555+5656+```bash
5757+git status
5858+git log --oneline -10
5959+git diff --stat
6060+```
6161+6262+## Step 3: Check Session Log
6363+6464+```bash
6565+cat git.log | tail -30
6666+```
6767+6868+## After Gathering Context, Report:
6969+7070+1. **Current branch** and pending changes
7171+2. **Branch-specific decisions** (filter by branch if on feature branch)
7272+3. **Recent decisions** (especially pending/active ones)
7373+4. **Last actions** from git log and command log
7474+5. **Open questions** or unresolved observations
7575+6. **Suggested next steps**
7676+7777+### Branch Configuration
7878+7979+Check `.deciduous/config.toml` for branch settings:
8080+8181+```toml
8282+[branch]
8383+main_branches = ["main", "master"] # Which branches are "main"
8484+auto_detect = true # Auto-detect branch on node creation
8585+```
8686+8787+---
8888+8989+## REMEMBER: Real-Time Logging Required
9090+9191+After recovering context, you MUST follow the logging workflow:
9292+9393+```
9494+EVERY USER REQUEST → Log goal/decision first
9595+BEFORE CODE CHANGES → Log action
9696+AFTER CHANGES → Log outcome, link nodes
9797+BEFORE GIT PUSH → deciduous sync
9898+```
9999+100100+**The user is watching the graph live.** Log as you go, not after.
101101+102102+### Quick Logging Commands
103103+104104+```bash
105105+# Root goal with user prompt (capture what the user asked for)
106106+deciduous add goal "What we're trying to do" -c 90 -p "User asked: <their request>"
107107+108108+deciduous add action "What I'm about to implement" -c 85
109109+deciduous add outcome "What happened" -c 95
110110+deciduous link FROM TO -r "Connection reason"
111111+112112+# Capture prompt when user redirects mid-stream
113113+deciduous add action "Switching approach" -c 85 -p "User said: use X instead"
114114+115115+deciduous sync # Do this frequently!
116116+```
117117+118118+**When to use `--prompt`:** On root goals (always) and when user gives new direction mid-stream. Downstream nodes inherit context via edges.
119119+120120+---
121121+122122+## Focus Areas
123123+124124+If $ARGUMENTS specifies a focus, prioritize context for:
125125+126126+- **auth**: Authentication-related decisions
127127+- **ui** / **graph**: UI and graph viewer state
128128+- **cli**: Command-line interface changes
129129+- **api**: API endpoints and data structures
130130+131131+---
132132+133133+## The Memory Loop
134134+135135+```
136136+SESSION START
137137+ ↓
138138+Run /recover → See past decisions
139139+ ↓
140140+AUDIT → Fix any orphan nodes first!
141141+ ↓
142142+DO WORK → Log BEFORE each action
143143+ ↓
144144+CONNECT → Link new nodes immediately
145145+ ↓
146146+AFTER CHANGES → Log outcomes, observations
147147+ ↓
148148+AUDIT AGAIN → Any new orphans?
149149+ ↓
150150+BEFORE PUSH → deciduous sync
151151+ ↓
152152+PUSH → Live graph updates
153153+ ↓
154154+SESSION END → Final audit
155155+ ↓
156156+(repeat)
157157+```
158158+159159+**Live graph**: https://notactuallytreyanastasio.github.io/deciduous/
160160+161161+---
162162+163163+## Multi-User Sync
164164+165165+If working in a team, check for and apply patches from teammates:
166166+167167+```bash
168168+# Check for unapplied patches
169169+deciduous diff status
170170+171171+# Apply all patches (idempotent - safe to run multiple times)
172172+deciduous diff apply .deciduous/patches/*.json
173173+174174+# Preview before applying
175175+deciduous diff apply --dry-run .deciduous/patches/teammate-feature.json
176176+```
177177+178178+Before pushing your branch, export your decisions for teammates:
179179+180180+```bash
181181+# Export your branch's decisions as a patch
182182+deciduous diff export --branch $(git rev-parse --abbrev-ref HEAD) \
183183+ -o .deciduous/patches/$(whoami)-$(git rev-parse --abbrev-ref HEAD).json
184184+185185+# Commit the patch file
186186+git add .deciduous/patches/
187187+```
188188+189189+## Why This Matters
190190+191191+- Context loss during compaction loses your reasoning
192192+- The graph survives - query it early, query it often
193193+- Retroactive logging misses details - log in the moment
194194+- The user sees the graph live - show your work
195195+- Patches share reasoning with teammates
+302
.claude/commands/decision.md
···11+---
22+description: Manage decision graph - track algorithm choices and reasoning
33+allowed-tools: Bash(deciduous:*)
44+argument-hint: <action> [args...]
55+---
66+77+# Decision Graph Management
88+99+**Log decisions IN REAL-TIME as you work, not retroactively.**
1010+1111+## When to Use This
1212+1313+| You're doing this... | Log this type | Command |
1414+| --------------------------- | ------------------ | ------------------------------------------------------ |
1515+| Starting a new feature | `goal` **with -p** | `/decision add goal "Add user auth" -p "user request"` |
1616+| Choosing between approaches | `decision` | `/decision add decision "Choose auth method"` |
1717+| Considering an option | `option` | `/decision add option "JWT tokens"` |
1818+| About to write code | `action` | `/decision add action "Implementing JWT"` |
1919+| Noticing something | `observation` | `/decision add obs "Found existing auth code"` |
2020+| Finished something | `outcome` | `/decision add outcome "JWT working"` |
2121+2222+## Quick Commands
2323+2424+Based on $ARGUMENTS:
2525+2626+### View Commands
2727+2828+- `nodes` or `list` -> `deciduous nodes`
2929+- `edges` -> `deciduous edges`
3030+- `graph` -> `deciduous graph`
3131+- `commands` -> `deciduous commands`
3232+3333+### Create Nodes (with optional metadata)
3434+3535+- `add goal <title>` -> `deciduous add goal "<title>" -c 90`
3636+- `add decision <title>` -> `deciduous add decision "<title>" -c 75`
3737+- `add option <title>` -> `deciduous add option "<title>" -c 70`
3838+- `add action <title>` -> `deciduous add action "<title>" -c 85`
3939+- `add obs <title>` -> `deciduous add observation "<title>" -c 80`
4040+- `add outcome <title>` -> `deciduous add outcome "<title>" -c 90`
4141+4242+### Optional Flags for Nodes
4343+4444+- `-c, --confidence <0-100>` - Confidence level
4545+- `-p, --prompt "..."` - Store the user prompt that triggered this node
4646+- `-f, --files "file1.rs,file2.rs"` - Associate files with this node
4747+- `-b, --branch <name>` - Git branch (auto-detected by default)
4848+- `--no-branch` - Skip branch auto-detection
4949+- `--commit <hash|HEAD>` - Link to a git commit (use HEAD for current commit)
5050+5151+### ⚠️ CRITICAL: Link Commits to Actions/Outcomes
5252+5353+**After every git commit, link it to the decision graph!**
5454+5555+```bash
5656+git commit -m "feat: add auth"
5757+deciduous add action "Implemented auth" -c 90 --commit HEAD
5858+deciduous link <goal_id> <action_id> -r "Implementation"
5959+```
6060+6161+## CRITICAL: Capture VERBATIM User Prompts
6262+6363+**Prompts must be the EXACT user message, not a summary.** When a user request triggers new work, capture their full message word-for-word.
6464+6565+**BAD - summaries are useless for context recovery:**
6666+6767+```bash
6868+# DON'T DO THIS - this is a summary, not a prompt
6969+deciduous add goal "Add auth" -p "User asked: add login to the app"
7070+```
7171+7272+**GOOD - verbatim prompts enable full context recovery:**
7373+7474+```bash
7575+# Use --prompt-stdin for multi-line prompts
7676+deciduous add goal "Add auth" -c 90 --prompt-stdin << 'EOF'
7777+I need to add user authentication to the app. Users should be able to sign up
7878+with email/password, and we need OAuth support for Google and GitHub. The auth
7979+should use JWT tokens with refresh token rotation.
8080+EOF
8181+8282+# Or use the prompt command to update existing nodes
8383+deciduous prompt 42 << 'EOF'
8484+The full verbatim user message goes here...
8585+EOF
8686+```
8787+8888+**When to capture prompts:**
8989+9090+- Root `goal` nodes: YES - the FULL original request
9191+- Major direction changes: YES - when user redirects the work
9292+- Routine downstream nodes: NO - they inherit context via edges
9393+9494+**Updating prompts on existing nodes:**
9595+9696+```bash
9797+deciduous prompt <node_id> "full verbatim prompt here"
9898+cat prompt.txt | deciduous prompt <node_id> # Multi-line from stdin
9999+```
100100+101101+Prompts are viewable in the TUI detail panel (`deciduous tui`) and web viewer.
102102+103103+## Branch-Based Grouping
104104+105105+**Nodes are automatically tagged with the current git branch.** This enables filtering by feature/PR.
106106+107107+### How It Works
108108+109109+- When you create a node, the current git branch is stored in `metadata_json`
110110+- Configure which branches are "main" in `.deciduous/config.toml`:
111111+ ```toml
112112+ [branch]
113113+ main_branches = ["main", "master"] # Branches not treated as "feature branches"
114114+ auto_detect = true # Auto-detect branch on node creation
115115+ ```
116116+- Nodes on feature branches (anything not in `main_branches`) can be grouped/filtered
117117+118118+### CLI Filtering
119119+120120+```bash
121121+# Show only nodes from specific branch
122122+deciduous nodes --branch main
123123+deciduous nodes --branch feature-auth
124124+deciduous nodes -b my-feature
125125+126126+# Override auto-detection when creating nodes
127127+deciduous add goal "Feature work" -b feature-x # Force specific branch
128128+deciduous add goal "Universal note" --no-branch # No branch tag
129129+```
130130+131131+### Web UI Branch Filter
132132+133133+The graph viewer shows a branch dropdown in the stats bar:
134134+135135+- "All branches" shows everything
136136+- Select a specific branch to filter all views (Chains, Timeline, Graph, DAG)
137137+138138+### When to Use Branch Grouping
139139+140140+- **Feature work**: Nodes created on `feature-auth` branch auto-grouped
141141+- **PR context**: Filter to see only decisions for a specific PR
142142+- **Cross-cutting concerns**: Use `--no-branch` for universal notes
143143+- **Retrospectives**: Filter by branch to see decision history per feature
144144+145145+### Create Edges
146146+147147+- `link <from> <to> [reason]` -> `deciduous link <from> <to> -r "<reason>"`
148148+149149+### Sync Graph
150150+151151+- `sync` -> `deciduous sync`
152152+153153+### Multi-User Sync (Diff/Patch)
154154+155155+- `diff export -o <file>` -> `deciduous diff export -o <file>` (export nodes as patch)
156156+- `diff export --nodes 1-10 -o <file>` -> export specific nodes
157157+- `diff export --branch feature-x -o <file>` -> export nodes from branch
158158+- `diff apply <file>` -> `deciduous diff apply <file>` (apply patch, idempotent)
159159+- `diff apply --dry-run <file>` -> preview without applying
160160+- `diff status` -> `deciduous diff status` (list patches in .deciduous/patches/)
161161+- `migrate` -> `deciduous migrate` (add change_id columns for sync)
162162+163163+### Export & Visualization
164164+165165+- `dot` -> `deciduous dot` (output DOT to stdout)
166166+- `dot --png` -> `deciduous dot --png -o graph.dot` (generate PNG)
167167+- `dot --nodes 1-11` -> `deciduous dot --nodes 1-11` (filter nodes)
168168+- `writeup` -> `deciduous writeup` (generate PR writeup)
169169+- `writeup -t "Title" --nodes 1-11` -> filtered writeup
170170+171171+## Node Types
172172+173173+| Type | Purpose | Example |
174174+| ------------- | ------------------------- | ----------------------------- |
175175+| `goal` | High-level objective | "Add user authentication" |
176176+| `decision` | Choice point with options | "Choose auth method" |
177177+| `option` | Possible approach | "Use JWT tokens" |
178178+| `action` | Something implemented | "Added JWT middleware" |
179179+| `outcome` | Result of action | "JWT auth working" |
180180+| `observation` | Finding or data point | "Existing code uses sessions" |
181181+182182+## Edge Types
183183+184184+| Type | Meaning |
185185+| ---------- | ------------------------------ |
186186+| `leads_to` | Natural progression |
187187+| `chosen` | Selected option |
188188+| `rejected` | Not selected (include reason!) |
189189+| `requires` | Dependency |
190190+| `blocks` | Preventing progress |
191191+| `enables` | Makes something possible |
192192+193193+## Graph Integrity - CRITICAL
194194+195195+**Every node MUST be logically connected.** Floating nodes break the graph's value.
196196+197197+### Connection Rules
198198+199199+| Node Type | MUST connect to | Example |
200200+| ------------- | --------------------------------- | ---------------------------------------------- |
201201+| `outcome` | The action/goal it resolves | "JWT working" → links FROM "Implementing JWT" |
202202+| `action` | The decision/goal that spawned it | "Implementing JWT" → links FROM "Add auth" |
203203+| `option` | Its parent decision | "Use JWT" → links FROM "Choose auth method" |
204204+| `observation` | Related goal/action/decision | "Found existing code" → links TO relevant node |
205205+| `decision` | Parent goal (if any) | "Choose auth" → links FROM "Add auth feature" |
206206+| `goal` | Can be a root (no parent needed) | Root goals are valid orphans |
207207+208208+### Audit Checklist
209209+210210+Ask yourself after creating nodes:
211211+212212+1. Does every **outcome** link back to what caused it?
213213+2. Does every **action** link to why you did it?
214214+3. Does every **option** link to its decision?
215215+4. Are there **dangling outcomes** with no parent action/goal?
216216+217217+### Find Disconnected Nodes
218218+219219+```bash
220220+# List nodes with no incoming edges (potential orphans)
221221+deciduous edges | cut -d'>' -f2 | cut -d' ' -f2 | sort -u > /tmp/has_parent.txt
222222+deciduous nodes | tail -n+3 | awk '{print $1}' | while read id; do
223223+ grep -q "^$id$" /tmp/has_parent.txt || echo "CHECK: $id"
224224+done
225225+```
226226+227227+Note: Root goals are VALID orphans. Outcomes/actions/options usually are NOT.
228228+229229+### Fix Missing Connections
230230+231231+```bash
232232+deciduous link <parent_id> <child_id> -r "Retroactive connection - <why>"
233233+```
234234+235235+### When to Audit
236236+237237+- Before every `deciduous sync`
238238+- After creating multiple nodes quickly
239239+- At session end
240240+- When the web UI graph looks disconnected
241241+242242+## Multi-User Sync
243243+244244+**Problem**: Multiple users work on the same codebase, each with a local `.deciduous/deciduous.db` (gitignored). How to share decisions?
245245+246246+**Solution**: jj-inspired dual-ID model. Each node has:
247247+248248+- `id` (integer): Local database primary key, different per machine
249249+- `change_id` (UUID): Globally unique, stable across all databases
250250+251251+### Export Workflow
252252+253253+```bash
254254+# Export nodes from your branch as a patch file
255255+deciduous diff export --branch feature-x -o .deciduous/patches/alice-feature.json
256256+257257+# Or export specific node IDs
258258+deciduous diff export --nodes 172-188 -o .deciduous/patches/alice-feature.json --author alice
259259+```
260260+261261+### Apply Workflow
262262+263263+```bash
264264+# Apply patches from teammates (idempotent - safe to re-apply)
265265+deciduous diff apply .deciduous/patches/*.json
266266+267267+# Preview what would change
268268+deciduous diff apply --dry-run .deciduous/patches/bob-refactor.json
269269+```
270270+271271+### PR Workflow
272272+273273+1. Create nodes locally while working
274274+2. Export: `deciduous diff export --branch my-feature -o .deciduous/patches/my-feature.json`
275275+3. Commit the patch file (NOT the database)
276276+4. Open PR with patch file included
277277+5. Teammates pull and apply: `deciduous diff apply .deciduous/patches/my-feature.json`
278278+6. **Idempotent**: Same patch applied twice = no duplicates
279279+280280+### Patch Format (JSON)
281281+282282+```json
283283+{
284284+ "version": "1.0",
285285+ "author": "alice",
286286+ "branch": "feature/auth",
287287+ "nodes": [{ "change_id": "uuid...", "title": "...", ... }],
288288+ "edges": [{ "from_change_id": "uuid1", "to_change_id": "uuid2", ... }]
289289+}
290290+```
291291+292292+## The Rule
293293+294294+```
295295+LOG BEFORE YOU CODE, NOT AFTER.
296296+CONNECT EVERY NODE TO ITS PARENT.
297297+AUDIT FOR ORPHANS REGULARLY.
298298+SYNC BEFORE YOU PUSH.
299299+EXPORT PATCHES FOR YOUR TEAMMATES.
300300+```
301301+302302+**Live graph**: https://notactuallytreyanastasio.github.io/deciduous/
···5858 be sure
5959- Task tool (subagents for exploration, planning, etc.) may not always be accurate; verify subagent
6060 findings when needed
6161+6262+## Decision Graph Workflow
6363+6464+**THIS IS MANDATORY. Log decisions IN REAL-TIME, not retroactively.**
6565+6666+### The Core Rule
6767+6868+```
6969+BEFORE you do something -> Log what you're ABOUT to do
7070+AFTER it succeeds/fails -> Log the outcome
7171+CONNECT immediately -> Link every node to its parent
7272+AUDIT regularly -> Check for missing connections
7373+```
7474+7575+### Behavioral Triggers - MUST LOG WHEN:
7676+7777+| Trigger | Log Type | Example |
7878+| ---------------------------- | ------------------ | ------------------------------ |
7979+| User asks for a new feature | `goal` **with -p** | "Add dark mode" |
8080+| Choosing between approaches | `decision` | "Choose state management" |
8181+| About to write/edit code | `action` | "Implementing Redux store" |
8282+| Something worked or failed | `outcome` | "Redux integration successful" |
8383+| Notice something interesting | `observation` | "Existing code uses hooks" |
8484+8585+### CRITICAL: Capture VERBATIM User Prompts
8686+8787+**Prompts must be the EXACT user message, not a summary.** When a user request triggers new work,
8888+capture their full message word-for-word.
8989+9090+**BAD - summaries are useless for context recovery:**
9191+9292+```bash
9393+# DON'T DO THIS - this is a summary, not a prompt
9494+deciduous add goal "Add auth" -p "User asked: add login to the app"
9595+```
9696+9797+**GOOD - verbatim prompts enable full context recovery:**
9898+9999+```bash
100100+# Use --prompt-stdin for multi-line prompts
101101+deciduous add goal "Add auth" -c 90 --prompt-stdin << 'EOF'
102102+I need to add user authentication to the app. Users should be able to sign up
103103+with email/password, and we need OAuth support for Google and GitHub. The auth
104104+should use JWT tokens with refresh token rotation.
105105+EOF
106106+107107+# Or use the prompt command to update existing nodes
108108+deciduous prompt 42 << 'EOF'
109109+The full verbatim user message goes here...
110110+EOF
111111+```
112112+113113+**When to capture prompts:**
114114+115115+- Root `goal` nodes: YES - the FULL original request
116116+- Major direction changes: YES - when user redirects the work
117117+- Routine downstream nodes: NO - they inherit context via edges
118118+119119+**Updating prompts on existing nodes:**
120120+121121+```bash
122122+deciduous prompt <node_id> "full verbatim prompt here"
123123+cat prompt.txt | deciduous prompt <node_id> # Multi-line from stdin
124124+```
125125+126126+Prompts are viewable in the TUI detail panel (`deciduous tui`) and web viewer.
127127+128128+### ⚠️ CRITICAL: Maintain Connections
129129+130130+**The graph's value is in its CONNECTIONS, not just nodes.**
131131+132132+| When you create... | IMMEDIATELY link to... |
133133+| ------------------ | --------------------------------- |
134134+| `outcome` | The action/goal it resolves |
135135+| `action` | The goal/decision that spawned it |
136136+| `option` | Its parent decision |
137137+| `observation` | Related goal/action |
138138+139139+**Root `goal` nodes are the ONLY valid orphans.**
140140+141141+### Quick Commands
142142+143143+```bash
144144+deciduous add goal "Title" -c 90 -p "User's original request"
145145+deciduous add action "Title" -c 85
146146+deciduous link FROM TO -r "reason" # DO THIS IMMEDIATELY!
147147+deciduous serve # View live (auto-refreshes every 30s)
148148+deciduous sync # Export for static hosting
149149+150150+# Metadata flags
151151+# -c, --confidence 0-100 Confidence level
152152+# -p, --prompt "..." Store the user prompt (use when semantically meaningful)
153153+# -f, --files "a.rs,b.rs" Associate files
154154+# -b, --branch <name> Git branch (auto-detected)
155155+# --commit <hash|HEAD> Link to git commit (use HEAD for current commit)
156156+157157+# Branch filtering
158158+deciduous nodes --branch main
159159+deciduous nodes -b feature-auth
160160+```
161161+162162+### ⚠️ CRITICAL: Link Commits to Actions/Outcomes
163163+164164+**After every git commit, link it to the decision graph!**
165165+166166+```bash
167167+git commit -m "feat: add auth"
168168+deciduous add action "Implemented auth" -c 90 --commit HEAD
169169+deciduous link <goal_id> <action_id> -r "Implementation"
170170+```
171171+172172+The `--commit HEAD` flag captures the commit hash and links it to the node. The web viewer will show
173173+commit messages, authors, and dates.
174174+175175+### Git History & Deployment
176176+177177+```bash
178178+# Export graph AND git history for web viewer
179179+deciduous sync
180180+181181+# This creates:
182182+# - docs/graph-data.json (decision graph)
183183+# - docs/git-history.json (commit info for linked nodes)
184184+```
185185+186186+To deploy to GitHub Pages:
187187+188188+1. `deciduous sync` to export
189189+2. Push to GitHub
190190+3. Settings > Pages > Deploy from branch > /docs folder
191191+192192+Your graph will be live at `https://<user>.github.io/<repo>/`
193193+194194+### Branch-Based Grouping
195195+196196+Nodes are auto-tagged with the current git branch. Configure in `.deciduous/config.toml`:
197197+198198+```toml
199199+[branch]
200200+main_branches = ["main", "master"]
201201+auto_detect = true
202202+```
203203+204204+### Audit Checklist (Before Every Sync)
205205+206206+1. Does every **outcome** link back to what caused it?
207207+2. Does every **action** link to why you did it?
208208+3. Any **dangling outcomes** without parents?
209209+210210+### Session Start Checklist
211211+212212+```bash
213213+deciduous nodes # What decisions exist?
214214+deciduous edges # How are they connected? Any gaps?
215215+git status # Current state
216216+```
217217+218218+### Multi-User Sync
219219+220220+Share decisions across teammates:
221221+222222+```bash
223223+# Export your branch's decisions
224224+deciduous diff export --branch feature-x -o .deciduous/patches/my-feature.json
225225+226226+# Apply patches from teammates (idempotent)
227227+deciduous diff apply .deciduous/patches/*.json
228228+229229+# Preview before applying
230230+deciduous diff apply --dry-run .deciduous/patches/teammate.json
231231+```
232232+233233+PR workflow: Export patch → commit patch file → PR → teammates apply.