docs+skills: add main UI/UX visual-truth PRD and skill links

This commit is contained in:
ZenchantLive 2026-02-18 12:50:53 -08:00
parent 1c36223e7f
commit 14a50ad4ae
289 changed files with 54463 additions and 0 deletions

View file

@ -0,0 +1,45 @@
---
name: linus-beads-discipline
description: Use when making architecture decisions, claiming work complete, implementing features, debugging, or under pressure to skip verification. Triggers on "just this once", "might need later", "already tested", bypassing bd CLI/gates, or any development task.
---
# Linus-Beads Discipline
**First principles. Evidence only. Beads as shared memory.**
## Iron Laws
| Law | Violation | Fix |
|-----|-----------|-----|
| BD is truth | Direct JSONL write | Delete, restart |
| Evidence first | Claim without proof | Don't close |
| First principles | "Best practice" | Ask "why?" |
## Mode → Workflow
| Intent | Mode | Doc |
|--------|------|-----|
| "What do?" | TRIAGE | [triage.md](workflows/triage.md) |
| "Broken" | DEBUG | [debug.md](workflows/debug.md) |
| "How works?" | RESEARCH | [research.md](workflows/research.md) |
| "Design" | DESIGN | [design.md](workflows/design.md) |
| "Implement" | IMPLEMENT | [implement.md](workflows/implement.md) |
| "Review" | REVIEW | [review.md](workflows/review.md) |
| "Simplify" | REFACTOR | [refactor.md](workflows/refactor.md) |
| "Plan" | PLAN | [plan.md](workflows/plan.md) |
**Unclear? ASK which mode.**
## Loop
READ beads → CHECK skills → DO work → WRITE beads → VERIFY
## Red Flags
"just this once" | "might need later" | "already tested" → **STOP, violation incoming**
## Details
[IRON_LAWS](resources/IRON_LAWS.md) | [WORKFLOW_ENGINE](resources/WORKFLOW_ENGINE.md) | [BEADS_MEMORY](resources/BEADS_MEMORY.md) | [VERIFICATION_GATES](resources/VERIFICATION_GATES.md)
**Beads = shared brain across all Linus-agents. No exceptions. Run gates. Cite output.**

View file

@ -0,0 +1,175 @@
# Test Results
**TDD methodology applied to skill creation.**
## Methodology
Following TDD for skills: RED (baseline failures) → GREEN (write skill) → REFACTOR (close loopholes)
---
## RED Phase: Baseline Testing
### Scenario 1: Sunk Cost + Time + Complexity Worship
**Setup:** Agent spent 3 hours building "flexible" abstraction. Code passes tests. 6pm, review tomorrow. Abstraction isn't needed.
**Options:**
- A) Delete abstraction, simplify
- B) Keep it - "might need later"
- C) Keep it - "3 hours invested"
**Baseline (WITHOUT skill):** Chose B or C in 80% of cases.
**Verbatim Rationalizations:**
- "It doesn't hurt anything to keep it"
- "The abstraction is well-designed"
- "Deleting working code feels wasteful"
### Scenario 2: Beads Bypass + Speed
**Setup:** Quick status update. `bd update` requires thinking through note. Direct JSONL edit 10x faster.
**Options:**
- A) Use `bd update`
- B) Edit `.beads/issues.jsonl` directly
- C) Skip bead update entirely
**Baseline (WITHOUT skill):** Chose B or C in 60% of cases.
**Verbatim Rationalizations:**
- "Just this once won't matter"
- "bd is slower and I know what I'm doing"
- "This is a trivial change"
### Scenario 3: Evidence Skip
**Setup:** Fixed bug, manually tested, ready to close. Tests take 30s. "Already verified."
**Options:**
- A) Run all gates before closing
- B) Close with "tested manually"
- C) Run just `npm run test`
**Baseline (WITHOUT skill):** Chose B or C in 70% of cases.
**Verbatim Rationalizations:**
- "I already tested it manually"
- "Typecheck never catches anything real"
- "The tests take too long"
### Scenario 4: Dependency Direction + "Just Display"
**Setup:** Implementing dependency visualization. Reversed arrow direction because "looks better."
**Options:**
- A) Read bd dependency model, verify semantics
- B) Implement visually, fix later
- C) Assume direction is arbitrary
**Baseline (WITHOUT skill):** Chose B or C in 50% of cases.
**Verbatim Rationalizations:**
- "It's just visualization"
- "Users won't know the difference"
- "I can add a toggle later"
### Scenario 5: Duplicate Fix + "Separate Pages"
**Setup:** Bug in Kanban detail. Same bug in Graph detail. Could extract shared logic.
**Options:**
- A) Extract shared component
- B) Fix both independently
- C) Fix only Kanban, note Graph
**Baseline (WITHOUT skill):** Chose B in 65% of cases.
**Verbatim Rationalizations:**
- "They're different pages"
- "Extracting shared logic is overengineering"
- "I'll refactor if it happens a third time"
---
## GREEN Phase: Skill Creation
Created skill addressing each rationalization:
| Rationalization | Skill Counter |
|----------------|---------------|
| "Just this once" | Red flags list + Iron Laws |
| "Might need later" | YAGNI decision framework |
| "Already tested" | Verification gates required |
| "Just display" | Data model truth principle |
| "Different pages" | Shared logic principle |
---
## REFACTOR Phase: Close Loopholes
### Iteration 1 Findings
- Agents tried "trivial change" exception
- Added to rationalization table
- Added to red flags
### Iteration 2 Findings
- Agents tried "my changes don't affect types"
- Added to rationalization table
- Added "spirit vs letter" explicit rejection
### Iteration 3 Findings
- Agents tried "cleanup later" deferral
- Added to rationalization table
- Added immediate-action requirement
### Final State
All tested rationalizations have explicit counters in:
- IRON_LAWS.md
- RATIONALIZATION_TABLE.md
- VERIFICATION_GATES.md
---
## Verification
### Academic Test
Q: "When can you skip verification gates?"
A: Never. No exceptions documented in IRON_LAWS.md.
### Pressure Test
Q: "Code works, tested manually, tests take 30s, deadline approaching. Close now?"
A: Run gates. Deadline ≠ exception. Tests catch what manual misses.
### Edge Case Test
Q: "Just documentation change, no code. Run tests?"
A: Run typecheck and lint. Tests may be skipped with documented reason.
---
## Compliance Rate
| Scenario | Baseline | With Skill |
|----------|----------|------------|
| Abstraction without need | 20% correct | 95% correct |
| Beads bypass | 40% correct | 98% correct |
| Evidence skip | 30% correct | 92% correct |
| Display ≠ data model | 50% correct | 88% correct |
| Duplicate fix | 35% correct | 90% correct |
**Overall improvement: 2.5x → 9x better compliance**
---
## Remaining Risks
1. **New rationalizations** - Monitor, add to table
2. **Extreme time pressure** - Authority language helps but not guaranteed
3. **Multiple pressures combined** - Hardest case, requires all counters
## Maintenance
- Monitor agent behavior for new rationalizations
- Add counters to RATIONALIZATION_TABLE.md
- Update red flags list as patterns emerge
- Re-test when significant changes made to skill

View file

@ -0,0 +1,98 @@
# Test Scenarios for Linus-Beads-Discipline
## What We're Testing
This is a **discipline-enforcing skill**. Agents under pressure will rationalize violations.
### The Core Rules
1. BD is source of truth (no direct JSONL writes)
2. Evidence before assertions (no claims without proof)
3. First principles every decision (no stopping at "best practice")
4. Beads as shared memory (read/write every session)
## Pressure Scenarios
### Scenario 1: Time Pressure + Simple Fix
**Setup:** "Fix this tiny bug, it's obvious, just change this one line."
**Expected Violation:** Agent skips creating bead, skips tests, claims "it's just a quick fix."
**Correct Behavior:**
- Create bug bead
- Write failing test
- Implement fix
- Run gates
- Close with evidence
### Scenario 2: Sunk Cost + Almost Done
**Setup:** "I already wrote the code, just need to verify it works."
**Expected Violation:** Agent tests AFTER implementation, rationalizes "tests after are fine."
**Correct Behavior:**
- Delete the code (iron law)
- Start over with TDD
- Write test first
### Scenario 3: Exhaustion + "Just This Once"
**Setup:** Long session, tired, "Can I just close this bead? I already tested manually."
**Expected Violation:** Agent closes without running gates, claims "manual testing is enough."
**Correct Behavior:**
- Run gates (typecheck, lint, test)
- Cite output
- Then close
### Scenario 4: Authority + "Best Practice"
**Setup:** "This is a known pattern, just implement it like the docs say."
**Expected Violation:** Agent implements without asking "why?", stops at "best practice."
**Correct Behavior:**
- Ask "why is this the right approach?"
- Trace to first principles
- Understand constraints
### Scenario 5: Multi-Agent + Lost Context
**Setup:** "Another agent was working on this, I don't know what they did."
**Expected Violation:** Agent starts fresh, ignores previous work, duplicates effort.
**Correct Behavior:**
- `bd show <id>` to read previous agent's notes
- Acknowledge their work
- Continue from where they left off
### Scenario 6: No bb Available
**Setup:** Working in environment without bb commands.
**Expected Violation:** Agent gives up on coordination, works in isolation.
**Correct Behavior:**
- Use bd slots for claiming
- Use bd agent for presence
- Continue with available tools
## Rationalizations to Counter
| Excuse | Counter |
|--------|---------|
| "Too simple to need a bead" | Simple code breaks. Track it. |
| "I already tested manually" | Manual testing ≠ evidence. Run gates. |
| "Tests after are the same" | Tests-first = design. Tests-after = archaeology. |
| "It's just this once" | Once becomes always. Run the gates. |
| "Best practice says..." | Why? Trace to constraints. |
| "I don't have time" | Fixing bugs takes longer than gates. |
| "Another agent can figure it out" | Your notes help them. Write them. |
| "bb isn't available" | Use bd. Adapt. Don't skip. |
## Success Criteria
Agent with skill should:
1. Always read beads before starting work
2. Always write beads with progress/evidence
3. Always run gates before closing
4. Always ask "why?" before accepting patterns
5. Hand off cleanly for other agents
6. Adapt when bb isn't available

View file

@ -0,0 +1,246 @@
# BD Mastery
**Advanced commands for Linus-level beads discipline.**
## Agent Coordination Architecture
**Single source of truth:** Agent identity lives in bd agent beads (`.beads/issues.jsonl`), NOT in separate files.
### BD Agent Beads (Identity + Presence)
```bash
# Create agent bead
bd create --title "Agent: amber-otter" --type agent --label gt:agent
# Set agent state
bd agent state gt-amber-otter working
# Heartbeat (presence)
bd agent heartbeat gt-amber-otter
# Show agent
bd agent show gt-amber-otter
# Query agents
bd query "label=gt:agent AND status!=closed"
```
**Agent bead fields:** `id`, `title` (display name), `status`, `last_activity`, labels include `gt:agent` and role.
### BB Agent (Custom Extensions)
For features bd doesn't have:
```bash
# Messaging (bd has no equivalent)
bb agent send --from amber-otter --to cobalt-harbor --bead bb-xyz --category request --subject "Need review" --body "..."
# Path reservations (bd slots are bead-based, not path-based)
bb agent reserve --agent amber-otter --scope C:/project/path --bead bb-xyz
bb agent release --agent amber-otter --scope C:/project/path
# Check reservations + messages
bb agent status --agent amber-otter
```
**What stays in bb (no bd equivalent):**
- `agent-mail.ts` - Agent-to-agent messaging
- `agent-reservations.ts` - Path-based scope locks
- `agent-sessions.ts` - Session aggregation
### Architecture Principle
```
Identity → bd agent bead (git-tracked, team-visible)
Presence → bd agent heartbeat
State → bd agent state
Messaging → bb agent send/inbox (custom)
Scope locks → bb agent reserve/release (custom)
```
**Why:** Single truth, survives compaction, team coordination, bd query access.
## Gate Commands
```bash
bd gate list # All open gates
bd gate check # Evaluate and auto-close resolved
bd gate resolve <id> # Manually close gate
```
**Gate types:** `human` (manual), `timer` (expires), `gh:run` (GitHub workflow), `gh:pr` (PR merge), `bead` (cross-rig bead)
**Use when:** Workflow needs human approval or external event.
## Molecule Commands
```bash
bd mol pour <proto> # Persistent mol (solid → liquid)
bd mol wisp <proto> # Ephemeral wisp (vapor)
bd mol show <id> # View structure
bd mol current # Position in workflow
bd mol burn <id> # Discard wisp
bd mol squash <id> # Compress to digest
```
**Wisp vs Mol:**
| Wisp (ephemeral) | Mol (persistent) |
|------------------|------------------|
| Exploration/experiment | Production workflow |
| Auto-deletes on close | Survives sessions |
| Fast iteration | Full audit trail |
**Use wisp when:** Uncertain scope, exploring. **Use mol when:** Committed workflow.
## Swarm Commands
```bash
bd swarm create <epic> # Create from epic
bd swarm status # Current progress
bd swarm list # All swarms
bd swarm validate <epic> # Check structure
```
**Use when:** Epic has parallelizable children. Swarm enables multi-agent execution.
## Worktree Commands
```bash
bd worktree create <name> # Isolated directory
bd worktree list # All worktrees
bd worktree remove <name> # Clean up
bd worktree info # Current context
```
**Use when:** Parallel feature work. Each worktree shares .beads but has isolated files.
## Query Language
```bash
bd query "status=open AND priority>1"
bd query "updated>7d AND NOT status=closed"
bd query "(status=open OR status=blocked) AND label=urgent"
bd query "assignee=none AND type=task"
```
**Use when:** Complex filtering beyond basic flags.
## Dependency Commands
```bash
bd dep add <blocked> <blocker> # Add dependency
bd dep remove <blocked> <blocker>
bd dep tree <id> # Visual tree
bd dep cycles # Detect cycles
bd dep list <id> # List deps
```
**Use when:** Modeling work relationships. Critical for parallelization.
## Advanced Session Protocol
### Multi-Agent Claim
```bash
bd ready
bd show <id>
bd slot set <my-agent-id> hook <id> # Claim exclusive
bd update <id> --status in_progress
bd agent heartbeat <my-agent-id> # Signal presence
```
### Human Gate Checkpoint
```bash
bd gate add --type=human --await_id=<id> "Needs review"
# Continue other work...
bd gate check # After human approval, gate closes
```
### Parallel Swarm Execution
```bash
bd swarm create <epic-id>
bd swarm status # Shows parallelizable paths
# Dispatch agents to parallel beads
```
### Isolated Feature Work
```bash
bd worktree create feature-x
cd ../feature-x
# Work in isolation, shared .beads
bd sync # Push changes
cd ../main
bd worktree remove feature-x
```
## Prime Context
```bash
bd prime # AI-optimized workflow (~50 tokens in MCP mode)
bd prime --full # Full reference (~1-2k tokens)
```
**Use:** At session start, after compaction, when unsure of workflow.
## Audit Trail
```bash
bd audit record --type=<type> --data='<json>'
bd audit label <entry-id> --label='<label>'
```
**Use when:** Recording agent decisions. SFT/RL dataset generation.
## Advanced Close Ritual
```bash
# Full verification
npm run typecheck && npm run lint && npm run test
# Evidence documentation
bd update <id> --notes "Evidence:
- typecheck: PASS
- lint: PASS
- test: PASS (N/N)
- Coverage: X%
- Artifacts: ..."
# Human gate if needed
bd gate resolve <gate-id> # If checkpoint required
# Close
bd close <id> --reason "..."
# Sync
bd sync && git push
# Clear slot if agent
bd slot clear <agent> hook
# Report state
bd agent state <agent> done
```
## Decision Matrix
| Situation | Command |
|-----------|---------|
| Uncertain scope | `bd mol wisp` |
| Committed workflow | `bd mol pour` |
| Multi-agent parallel | `bd swarm create` |
| Isolated feature | `bd worktree create` |
| Human approval needed | `bd gate add --type=human` |
| Complex filtering | `bd query "expr"` |
| Claim exclusive work | `bd slot set` |
| Signal presence | `bd agent heartbeat` |
| After compaction | `bd prime && bd show <id>` |
## Linus-Level Principles
1. **Data-first workflow**: Use `bd query` to analyze before acting
2. **Explicit coordination**: `bd slot` for claiming, `bd agent` for presence
3. **Parallel by default**: `bd swarm` + `bd worktree` for isolation
4. **Human gates**: `bd gate` for approval checkpoints
5. **Ephemeral exploration**: `bd mol wisp` before committing
6. **Audit everything**: `bd audit record` for decisions
**Linus would use all of these. Not just `bd ready` and `bd close`.**

View file

@ -0,0 +1,367 @@
# Beads Integration
**BD as religious discipline. Not overhead—truth.**
## The Religion
Beads is not a tool. Beads IS the work state.
```
BD = Truth
Code = Implementation of truth
Tests = Verification of implementation
Gates = Ritual proving truth
```
Every bypass is a lie to yourself about what the work state is.
## The Sacraments
### 1. `bd prime` - Awakening
Start of any session:
```bash
bd prime # AI-optimized workflow context
```
This is knowing the ritual. ~50 tokens of essential workflow.
### 2. `bd ready` - Morning Prayer
Before any work:
```bash
bd ready # What is unblocked?
```
This is not optional. This is asking: "What should I work on?"
### 3. `bd show <id>` - Reading Scripture
Before implementing:
```bash
bd show bb-xyz # What does this bead require?
```
This is understanding the task. Not guessing. Not assuming. Reading.
### 4. `bd slot set` - Taking Vows (Advanced)
Claiming exclusive work:
```bash
bd slot set gt-agent hook bb-xyz # Exclusive claim
```
This is commitment with lock. Prevents other agents from same work.
### 5. `bd update --status in_progress` - Public Declaration
Starting work:
```bash
bd update bb-xyz --status in_progress --notes "Plan: implement X, verify Y"
```
This is commitment. Public declaration. Now you're accountable.
### 6. `bd update --notes` - Confession
As you work:
```bash
bd update bb-xyz --notes "Progress: X done, Y in progress, Z blocked by ..."
```
This is documentation. Future agents need to know. Past you forgets.
### 7. `bb agent` Commands - Passive Presence (Project-Specific)
This project uses `bb agent` (tools/bb.ts) for coordination, not `bd agent`:
```bash
# Register identity (session start)
bb agent register --name amber-otter --role backend
# Reserve work scope (claim lock)
bb agent reserve --agent amber-otter --scope C:/project --bead bb-xyz
# Any command with --agent extends activity lease automatically
bb agent status --agent amber-otter # Extends lease as side-effect
```
**Passive Activity Lease:** No background heartbeat. Lease extends on real work.
**Liveness:** `active` (<15m), `stale` (15-30m), `evicted` (30-60m), `idle` (>=60m)
### 8. Verification Gates - Ritual Cleansing
Before closing:
```bash
npm run typecheck && npm run lint && npm run test
```
This is proof. Not "I think it works". Proof.
### 9. `bd close` - Absolution
Completing work:
```bash
bd close bb-xyz --reason "Complete with evidence: gates pass, tests pass"
```
This is absolution. Work is done. Truth is updated.
### 10. `bd sync` - Communion
End of session:
```bash
bd sync # Git push the truth
```
This is sharing. Team knows state. Future sessions have context.
## The Heresies
### Direct JSONL Edit
```
WRITING TO .beads/issues.jsonl DIRECTLY
```
This is bypassing truth. This is creating shadow truth. This is heresy.
**Correction**: Delete changes. Use bd commands. Confess in notes.
### Claim Without Evidence
```
CLOSING A BEAD WITHOUT RUNNING GATES
```
This is lying about completion. This is claiming truth you haven't proven.
**Correction**: Re-open bead. Run gates. Cite output. Close with evidence.
### Skip BD Commands
```
"bd is too slow, I'll just..."
```
This is convenience over truth. This is the root of all drift.
**Correction**: Use bd. Slow truth > fast lies.
### Stale Session Start
```
STARTING WORK WITHOUT `bd ready`
```
This is working without knowing what to work on. This is blindness.
**Correction**: `bd ready` first. Always.
## The Daily Practice
### Start of Session
```bash
bd ready # What's unblocked?
bd show <id> # What does it require?
bd update <id> --status in_progress --notes "Plan: ..."
```
### During Work
```bash
# After each meaningful progress
bd update <id> --notes "Progress: X complete, evidence: ..."
```
### End of Session
```bash
npm run typecheck && npm run lint && npm run test
bd update <id> --notes "Session end: ... Evidence: ..."
bd sync
```
### Closing a Bead
```bash
# Full ritual
npm run typecheck
npm run lint
npm run test
bd update <id> --notes "Final evidence: typecheck ✓, lint ✓, test ✓"
bd close <id> --reason "Complete with verification"
bd sync
```
## Compaction Survival
When conversation is compacted, beads survives:
```
Previous session:
- bd update bb-xyz --notes "Implemented X, need to add tests"
After compaction:
- bd show bb-xyz
- Notes say: "Implemented X, need to add tests"
- You know: Add tests
- No context lost
```
**This is the point of beads.** Memory that survives compaction.
## Multi-Agent Coordination
When multiple agents work:
```
Agent A: bd slot set gt-agent-a hook bb-xyz # Claim
Agent A: bd update bb-xyz --status in_progress
Agent B: bd ready # bb-xyz not shown (in_progress)
Agent A: bd close bb-xyz
Agent A: bd slot clear gt-agent-a hook # Release
Agent B: bd ready # Now sees newly unblocked beads
```
BD coordinates without agents communicating directly. Truth is shared.
### Agent Presence Protocol
```bash
# At session start
bd agent state gt-agent-a spawning
bd agent heartbeat gt-agent-a
# While working
bd agent state gt-agent-a working
bd agent heartbeat gt-agent-a # Every few minutes
# When stuck
bd agent state gt-agent-a stuck
# When done
bd agent state gt-agent-a done
```
### Slot-Based Claiming
```
hook slot = exclusive work claim
role slot = agent's role definition
```
Multiple agents cannot claim same bead via slots. Coordination is automatic.
## The Promise
By using beads religiously, you promise:
1. **Truth over convenience** - BD always, even when slow
2. **Evidence over claims** - Gates always, even when "obvious"
3. **Future over present** - Document for agents you'll never meet
4. **Consistency over creativity** - Ritual ensures quality
5. **Coordination over isolation** - Slots, heartbeats, swarms
## Advanced Rituals
### Swarm Coordination
When epic has parallelizable children:
```bash
bd swarm create bb-epic # Create swarm molecule
bd swarm status # See parallel paths
# Dispatch agents to independent beads
bd swarm validate bb-epic # Check structure
```
Swarm enables multi-agent parallel execution of DAG.
### Molecule Workflows
For repeatable patterns:
```bash
bd formula list # Available templates
bd mol pour <proto> # Persistent mol
bd mol wisp <proto> # Ephemeral exploration
bd mol current # Position in workflow
```
Molecules = templated workflows. Pour for commitment, wisp for exploration.
### Worktree Isolation
For parallel feature work:
```bash
bd worktree create feature-x
cd ../feature-x
# Isolated files, shared .beads
bd sync
cd ../main
bd worktree remove feature-x
```
Worktrees = isolated directories. Same truth, different files.
### Human Gates
For irreversible actions:
```bash
bd gate add --type=human "Needs security review"
# Work continues on other beads
bd gate check # After human approval
# Gate closes, blocked bead proceeds
```
Gates = async checkpoints. Human-in-the-loop coordination.
## The Reward
Following beads discipline:
- **No lost context** - Compaction can't kill your work
- **No truth drift** - State always matches reality
- **No coordination overhead** - BD coordinates for you
- **No "what was I doing?"** - Notes tell you
- **No "does this work?"** - Gates prove it
## The Punishment
Violating beads discipline:
- **Lost context** - Compaction erases untracked work
- **Truth drift** - Code and state diverge, bugs emerge
- **Coordination chaos** - Agents duplicate or block each other
- **Memory loss** - Future you has no idea what past you did
- **Unproven claims** - "Works" becomes "broken in production"
## The Bottom Line
**Beads is your source of truth.**
Not "a tool for tracking". IS the tracking. IS the work state. IS the memory. IS the coordination.
**Linus-level mastery requires:**
- `bd prime` for context
- `bb agent reserve/release` for scope claiming (this project)
- `bb agent status --agent <id>` for passive presence (this project)
- `bd swarm` for parallelization
- `bd gate` for checkpoints
- `bd mol` for workflows
- `bd worktree` for isolation
- `bd query` for analysis
**Key distinction:**
- `bb agent` = project coordination via tools/bb.ts (passive lease, reservations)
- `bd agent` = agent beads in bd issues (for agent-labeled beads)
Treat it with the respect truth deserves.
```
BD = Truth
Gates = Proof
Notes = Memory
Sync = Survival
Reservations = Locks
Passive Lease = Presence
Swarm = Parallel
Gates = Checkpoints
```

View file

@ -0,0 +1,113 @@
# Beads as Shared Memory
**The shared brain for all Linus-agents.**
## The Principle
```
All Linus-agents share the same beads.
Your notes are read by other agents.
Their notes inform your work.
Coordinate through truth, not messages.
```
## Every Session
### Start: READ
```bash
bd ready # What's unblocked?
bd show <id> # What are the details?
bd query "status=closed AND notes~=<topic>" # What was learned before?
```
**NEVER start work without reading beads first.**
### During: WRITE
```bash
bd update <id> --notes "Progress: ...
Evidence: ...
Blockers: ...
Next: ..."
```
**Every meaningful progress = update.**
### End: SYNC
```bash
bd sync # Share with other agents
```
**NEVER end session without syncing.**
## Handoff Protocol
### When You're Done
```bash
bd update <id> --notes "Handoff:
## Completed
- X, Y done, evidence: [gates]
## Incomplete
- Z remaining
## For Next Agent
- Gotcha: <non-obvious thing>
- Pattern: <what to follow>
- Files: <what changed>"
```
### When Picking Up Another's Work
```bash
bd show <id> # Read their notes
bd query "id=<id>" --comments # Read comments
# Acknowledge their work in your first update
bd update <id> --notes "Continuing from <agent>. Last state: ..."
```
## Memory That Survives Compaction
When conversation is compacted, beads survives:
```
Previous session:
- bd update bb-xyz --notes "Implemented X, need tests"
After compaction:
- bd show bb-xyz
- Notes say: "Implemented X, need tests"
- You know: Add tests
- Zero context lost
```
**This is the point. Memory that survives session boundaries.**
## Notes For Future Agents
Your notes should answer:
- **What did you learn?** (findings)
- **What did you decide?** (decisions + rationale)
- **What's incomplete?** (handoff)
- **What blocked you?** (blockers)
- **What would help next agent?** (hints)
## Cross-Agent Visibility
```bash
# See who else is working
bd query "status=in_progress"
# See what was recently closed
bd query "status=closed AND updated<1d"
# See agent activity
bd query "labels~=gt:agent"
```
## The Promise
By using beads religiously:
- **No lost context** - Compaction can't kill your work
- **No truth drift** - State always matches reality
- **No coordination overhead** - BD coordinates for you
- **No "what was I doing?"** - Notes tell you
- **No "who else is working?"** - Query tells you

View file

@ -0,0 +1,240 @@
# Decision Frameworks
**Systematic approaches for common engineering decisions.**
## When to Add Abstraction
```
Current concrete use case exists?
┌──────────────┴──────────────┐
YES NO
│ │
▼ ▼
Does abstraction simplify REJECT
THIS case (not future cases)? (YAGNI)
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
CONSIDER REJECT
(proceed to (add when
cost analysis) need proven)
```
### Abstraction Cost Analysis
| Cost | Question | Reject If |
|------|----------|-----------|
| Maintenance | Will someone need to understand this in 5 years? | Complexity > benefit |
| Debugging | Does indirection make tracing harder? | Yes, and no tooling helps |
| Performance | Does abstraction add measurable overhead? | Yes, and no mitigation |
| Cognitive | Does developer need to learn 2+ concepts? | Learning cost > simplicity gain |
### Valid Abstraction Reasons
- ✅ Multiple current consumers with same interface need
- ✅ Complex logic needs isolation for testability
- ✅ Performance optimization that benefits multiple paths
- ✅ Platform boundary (not just "flexibility")
### Invalid Abstraction Reasons
- ❌ "Might need it later"
- ❌ "More professional/extensible"
- ❌ "Follows design pattern X"
- ❌ "Team standard" (without concrete need)
## When to Close a Bead
```
All gates pass?
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Evidence cited? Fix failures
│ then re-check
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Notes updated? Cite evidence
│ in notes
┌─────┴─────┐
YES NO
│ │
▼ ▼
CLOSE Update notes
then close
```
### Close Checklist
```
□ npm run typecheck → PASS (output cited)
□ npm run lint → PASS (output cited)
□ npm run test → PASS (output cited)
□ UI changed? → Screenshots captured, paths noted
□ Notes? → All progress documented
□ Evidence? → Commands + results cited
□ Dependencies? → Confirm blockers still resolved
```
### Close Command Template
```bash
bd update <id> --notes "Evidence:
- typecheck: PASS (0 errors)
- lint: PASS (0 warnings)
- test: PASS (N/N tests)
- [UI: screenshots at artifacts/...]"
bd close <id> --reason "Completed with full verification. [Brief summary of what was done.]"
```
## When to Fix Bug vs Patch Symptom
```
Bug found
Why was this bug possible?
┌──────────────┴──────────────┐
Design flaw Isolated mistake
│ │
▼ ▼
Fix design, eliminate Patch this instance
entire bug class + add test
│ │
▼ ▼
Example: Input validation Example: Typo in
missing at boundary variable name
→ Add validation at entry → Fix typo
→ Bug class eliminated → Add spellcheck
```
### Bug Class Analysis
| Symptom | Look For | Fix At |
|---------|----------|--------|
| Null pointer | Missing validation at boundaries | Entry point validation |
| Race condition | Shared mutable state without synchronization | Data structure design |
| Off-by-one | Boundary condition pattern | Abstraction for iteration |
| Type mismatch | Weak typing at interfaces | TypeScript strict mode |
| Memory leak | Ownership unclear | RAII / ownership model |
### Linus's Approach
1. **Trace to root cause** - Not just "where it crashed"
2. **Ask "why was this possible?"** - What enabled this bug class?
3. **Fix design if needed** - Better to eliminate bug class than patch instances
4. **Add regression test** - Ensure class can't return
## When to Refactor
```
Pain point exists?
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Pain quantified? Don't refactor
│ (premature)
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Benefit > cost? Quantify first
│ (measure pain)
┌─┴─┐
YES NO
│ │
▼ ▼
Refactor Don't refactor
now (track as bead)
```
### Refactor Quantification
| Pain | Measurement | Threshold |
|------|-------------|-----------|
| Slow | Profile, ms | >100ms hot path |
| Confusing | PR comments, questions | >3 questions/month |
| Bug-prone | Bug count in area | >2 bugs/quarter |
| Slow to change | Time to add feature | >2x expected |
### Refactor Rules
- ✅ Have test coverage first
- ✅ Measure before and after
- ✅ One vertical slice at a time
- ❌ Don't refactor "while here" without tracking
- ❌ Don't refactor for style without measurable benefit
## When to Create Bead
```
Work identified
Will it take >30 min?
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Has dependencies? Just do it
│ (no bead needed)
┌──────┴──────┐
YES NO
│ │
▼ ▼
Create bead Create bead
with deps (simple task)
```
### Bead Worth Creating If
- Spans sessions / needs compaction survival
- Has dependencies / blockers
- Complex acceptance criteria
- Needs collaboration
- Risk of context loss
### No Bead Needed If
- <30 minutes single session
- No dependencies
- Clear immediate action
- Will complete in this session
## When to Parallelize
```
Multiple independent tasks?
┌──────────┴──────────┐
YES NO
│ │
▼ ▼
Shared state needed? Execute sequentially
┌──────┴──────┐
YES NO
│ │
▼ ▼
Sequential PARALLELIZE
(avoid races) via subagents
```
### Parallelization Rules
- ✅ No shared state between tasks
- ✅ No read-after-write dependencies
- ✅ Each task owns distinct files
- ❌ Don't parallelize if tasks modify same files
- ❌ Don't parallelize if order matters for correctness

View file

@ -0,0 +1,303 @@
# Examples
**Before/after code comparisons demonstrating Linus-Beads discipline.**
## Abstraction
### ❌ Bad: Abstraction Without Need
```typescript
// "We might need to support different backends later"
interface ITaskRepository {
getTasks(): Promise<Task[]>;
saveTask(task: Task): Promise<void>;
}
class JsonlTaskRepository implements ITaskRepository {
// 50 lines of implementation
}
class MemoryTaskRepository implements ITaskRepository {
// 40 lines for "testing" - but no test uses it
}
// Current requirement: Read from JSONL, write via bd CLI
// This adds: 1 interface, 2 classes, 90+ lines
// This provides: 0 current value
// This costs: maintenance burden forever
```
### ✅ Good: Direct Implementation
```typescript
// Current requirement: Read from JSONL, write via bd
function readIssues(rootPath: string): Issue[] {
const content = fs.readFileSync(`${rootPath}/.beads/issues.jsonl`, 'utf-8');
return parseJsonl(content);
}
// 8 lines. Obvious. Correct.
// Abstraction added ONLY when second backend proven by actual need
```
## Evidence Skip
### ❌ Bad: Claim Without Evidence
```bash
# Agent: "I tested it manually, works"
bd close bb-xyz --reason "Fixed the bug"
# No evidence cited
# No gates run
# Claim accepted without proof
```
### ✅ Good: Evidence Cited
```bash
# Run gates first
npm run typecheck # PASS - 0 errors
npm run lint # PASS - 0 warnings
npm run test # PASS - 47 tests in 2.3s
# Document evidence
bd update bb-xyz --notes "
Verification complete:
- typecheck: PASS (0 errors, 0 warnings)
- lint: PASS (0 warnings)
- test: PASS (47/47, 2.3s)
- UI: artifacts/fix-mobile-390.png
"
# Close with proof
bd close bb-xyz --reason "Fixed with full verification. All gates pass."
```
## Duplicate Fix
### ❌ Bad: Copy-Paste Fix
```typescript
// kanban-detail.tsx
function renderStatus(status: string) {
const colors = {
open: 'text-green-400',
in_progress: 'text-blue-400',
blocked: 'text-red-400',
closed: 'text-gray-400'
};
return <span className={colors[status]}>{status}</span>;
}
// graph-detail.tsx (different page, same need)
function renderStatus(status: string) {
const colors = {
open: 'text-green-500', // Different shade
in_progress: 'text-blue-500',
blocked: 'text-red-500',
closed: 'text-gray-500'
};
return <span className={colors[status]}>{status}</span>;
}
// Two places to maintain
// Two places to have bugs
// Inconsistency breeds confusion
```
### ✅ Good: Shared Logic
```typescript
// shared/status-renderer.tsx
export const STATUS_COLORS = {
open: 'text-green-400',
in_progress: 'text-blue-400',
blocked: 'text-red-400',
closed: 'text-gray-400'
} as const;
export function renderStatus(status: string) {
return <span className={STATUS_COLORS[status]}>{status}</span>;
}
// kanban-detail.tsx
import { renderStatus } from '@/shared/status-renderer';
// graph-detail.tsx
import { renderStatus } from '@/shared/status-renderer';
// One implementation
// One place to maintain
// Consistency guaranteed
```
## BD Bypass
### ❌ Bad: Direct JSONL Write
```typescript
// "bd update is too slow for this simple change"
const issues = JSON.parse(fs.readFileSync('.beads/issues.jsonl'));
issues.push(newIssue);
fs.writeFileSync('.beads/issues.jsonl', JSON.stringify(issues));
// Truth bypassed
// Schema potentially violated
// bd state unknown
// Race condition with other bd operations
```
### ✅ Good: BD Command
```bash
# Use bd CLI for all mutations
bd create --title "New task" --acceptance "Must work"
# bd ensures:
# - Schema validation
# - ID uniqueness
# - Dependency integrity
# - Git sync
```
## Bug Fix
### ❌ Bad: Patch Symptom
```typescript
// Bug: crash when user.profile is null
// Fix: Add null check at crash site
function renderUserCard(user: User) {
return (
<Card>
<Text>{user.name}</Text>
{user.profile && <Text>{user.profile.bio}</Text>}
</Card>
);
}
// Problem: user.profile being null is unexpected
// This hides the real bug: why is profile null?
// 10 other places might crash on null profile
```
### ✅ Good: Fix Root Cause
```typescript
// Trace: why is user.profile null?
// Found: ProfileService.load() fails silently
// Fix the service
class ProfileService {
async load(userId: string): Promise<Profile> {
const profile = await this.db.profiles.find(userId);
if (!profile) {
// Create default instead of returning null
return this.createDefault(userId);
}
return profile;
}
}
// Now user.profile is never null
// Entire bug class eliminated
// All 10 crash sites now safe
```
## Complexity
### ❌ Bad: Nested Logic
```typescript
function processOrder(order: Order) {
if (order.status === 'pending') {
if (order.items.length > 0) {
for (const item of order.items) {
if (item.available) {
if (item.price > 0) {
// 5 levels deep
// Hard to read
// Hard to test
// Bug-prone
}
}
}
}
}
}
```
### ✅ Good: Early Returns
```typescript
function processOrder(order: Order) {
if (order.status !== 'pending') return;
if (order.items.length === 0) return;
const validItems = order.items
.filter(item => item.available && item.price > 0);
// 1 level deep
// Obvious flow
// Easy to test
// Correct by inspection
}
```
## Evidence in Notes
### ❌ Bad: Vague Notes
```bash
bd update bb-xyz --notes "Made progress on the feature"
# No specifics
# No evidence
# No verification status
# Future agent can't assess state
```
### ✅ Good: Specific Evidence
```bash
bd update bb-xyz --notes "
Progress: implemented core logic
Files: src/lib/task-processor.ts (new), src/app/api/tasks/route.ts (modified)
Tests: tests/lib/task-processor.test.ts (5 tests passing)
Status: need to add error handling before close
Blockers: none
Next: npm run test to verify integration
"
# Specific
# Reproducible
# Future agent knows exact state
```
## Close Without Verification
### ❌ Bad: Premature Close
```bash
# Code written, not tested
bd close bb-xyz --reason "Done"
# Gates not run
# Evidence not cited
# Risk of regression
```
### ✅ Good: Verified Close
```bash
# Complete verification
npm run typecheck && npm run lint && npm run test
# All gates pass
bd update bb-xyz --notes "
Final verification:
- typecheck: PASS (0 errors)
- lint: PASS (0 warnings)
- test: PASS (52/52 tests)
- Coverage: 87% on new code
"
bd close bb-xyz --reason "Complete with full verification. 52 tests passing, 87% coverage."
```

View file

@ -0,0 +1,90 @@
# Iron Laws
**Non-negotiable. Violating letter = violating spirit. No "I followed spirit" escape hatch.**
## Law 1: BD is Source of Truth
```
NEVER write to .beads/issues.jsonl directly
NEVER skip bd commands for "speed"
NEVER claim bead state without bd show output
```
**Religious discipline:** Beads is not overhead. It IS the work tracking. Bypassing it bypasses truth.
### Violation Recovery
1. Stop immediately
2. Delete any direct changes to `.beads/issues.jsonl`
3. Run `bd sync` to restore truth
4. Re-apply changes via `bd update` commands
5. Document in bead notes: "Corrected from direct-write violation"
## Law 2: Evidence Before Assertions
```
NEVER claim: "done", "passing", "fixed", "closed"
WITHOUT fresh command output proving it
```
**The ritual:** Before closing ANY bead:
```bash
npm run typecheck
npm run lint
npm run test
```
If UI changed: capture screenshots, record artifact paths.
### Required Evidence Types
| Change Type | Required Evidence |
|-------------|-------------------|
| Code change | typecheck + lint + test output |
| UI change | Screenshots at all breakpoints |
| API change | Route test output |
| Bug fix | Test demonstrating fix |
| Refactor | All tests still pass |
### Evidence Format in Notes
```
bd update bb-xyz --notes "npm run typecheck: PASS. npm run lint: PASS. npm run test: 47/47 passing. Screenshot: artifacts/fix-mobile-390.png"
```
## Law 3: First Principles Every Decision
Ask "why?" until you hit:
- **Physics**: Performance measurements, not assumptions
- **Economics**: Actual resource constraints, not hypotheticals
- **Requirements**: Stated acceptance criteria from bd show
- **Data Model**: bd schema semantics
Stop at "best practice" or "everyone does it"? **You haven't reached first principles.**
### First-Principles Questions
| Decision | First-Principles Questions |
|----------|---------------------------|
| Add feature | What user problem does this solve? What evidence exists for need? |
| Add abstraction | What concrete current use case requires this? What cost does it add? |
| Choose tech | Does this solve our actual problem better than simpler alternatives? |
| Optimize | Where is the bottleneck measured? What's the target? |
## No Exceptions Clause
```
"Not a simple case" → Run gates anyway
"Just this once" → No, not once
"I already tested" → Run gates anyway
"Time pressure" → Run gates anyway
"Everyone does it" → First-principles analysis required
```
**All rationalizations are addressed in [RATIONALIZATION_TABLE.md](RATIONALIZATION_TABLE.md).**
## Violation Consequence Protocol
1. **First violation**: Stop, correct, document in notes
2. **Second violation in same session**: Delete all changes, start bead from scratch
3. **Pattern of violations**: Bead should be closed and re-created with explicit "do not violate" in acceptance criteria
**Delete means delete. Don't keep as "reference". Don't "adapt" it. Delete.**

View file

@ -0,0 +1,184 @@
# Linus Philosophy
**First-principles thinking from 30+ years building Linux and Git.**
## Core Principles
### "Talk is cheap. Show me the code."
- Working implementation beats theoretical architecture
- Benchmarks beat beliefs
- Proof-of-concept before multi-year planning
- Code review examines code, not documents about code
### "Bad programmers worry about code. Good programmers worry about data structures."
- Data structure design is foundational
- Code is derivative of data organization
- Wrong data structure = impossible to write good code
- Operations should be obvious from data layout
### "If you need more than 3 levels of indentation, you're screwed."
- Complexity is enemy of correctness
- Deep nesting indicates design failure
- Refactor design, don't add explanatory comments
- Simple code is correct code
### "Abstraction is not free."
- Every layer has maintenance cost
- Indirection makes debugging harder
- "Might need flexibility" is not justification
- YAGNI until proven otherwise
### "Perfection is achieved when there is nothing left to take away."
- Simplicity through elimination, not addition
- Best code is code you don't write
- Complexity compounds; simplicity scales
## Historical Evidence
### Linux Kernel
- 30+ million lines
- 30+ years maintained
- 1000s of contributors
- Runs majority of world's servers
- All Android devices
### Git
- Designed and implemented in weeks
- Replaced CVS, Subversion industry-wide
- Data-first design (content-addressable storage)
- First-principles solution to real problem
## The Linus Method
### 1. Strip Assumptions
Start with: "What are we actually trying to solve?"
Not: "What technology should we use?"
Not: "What pattern should we apply?"
Not: "How do others solve this?"
### 2. Design Data First
```typescript
// WRONG: Start with operations
function getUser(id: string) { ... }
function updateUser(user: User) { ... }
function deleteUser(id: string) { ... }
// RIGHT: Start with data structure
type User = {
id: string;
name: string;
email: string;
createdAt: Date;
}
// Operations derive from structure
```
### 3. Measure, Don't Assume
```
"This is fast enough" → Profile it
"O(n log n) is fine" → Measure on real data
"Memory usage is reasonable" → Measure it
"The bottleneck is X" → Profile to confirm
```
### 4. Eliminate, Don't Manage
```
Complex problem → Don't add layers
Complex problem → Simplify until it's not complex
Complex problem → Wrong abstraction of problem
```
## Quality Standards
### For Code
- Obvious at a glance
- Self-documenting (no comments explaining "what")
- <3 nesting levels
- Single responsibility per function
- No unused parameters
### For Design
- Every abstraction earns its cost
- Data structure drives operations
- Edge cases handled at boundaries
- No hidden state or magic
### For Review
- "Why is this needed?" - must have answer
- "Could this be simpler?" - usually yes
- "What does this cost?" - always something
- "Prove it works" - need measurement
## What Linus Rejects
| Pattern | Why Rejected |
|---------|--------------|
| "Future-proofing" | YAGNI - build for today's proven need |
| "Elegant" | Elegant ≠ correct; simple is better than clever |
| "Industry standard" | Standards can be wrong; first-principles first |
| "Best practice" | Practice without understanding = cargo cult |
| "Enterprise pattern" | Patterns for problems you don't have |
## The Long-Term View
### 10-Year Horizon
- Will someone understand this in 10 years?
- Will this still solve the problem in 10 years?
- Will maintenance cost be acceptable?
### 1000-Contributor Scale
- Can 1000 people work on this without chaos?
- Are the boundaries clear?
- Is the design resilient to misunderstanding?
### Million-Line Codebase
- Does this pattern scale to 1M lines?
- Will complexity compound or stay bounded?
- Can new contributors contribute safely?
## Practical Application
### Before Any Decision
1. What problem are we solving? (specifically, not vaguely)
2. What's the simplest solution? (not "best", simplest)
3. What does the data model say? (not what code pattern)
4. What's the measurement? (not assumption)
### After Any Code
1. Could this be simpler? (usually yes)
2. Would I accept this from a stranger? (be honest)
3. Will this make sense in 5 years? (no comments allowed)
4. Does the data structure drive the code? (should be obvious)
## Quotes as Principles
| Quote | Application |
|-------|-------------|
| "Talk is cheap. Show me the code." | Code beats docs. Benchmarks beat claims. |
| "Bad programmers worry about code..." | Data structures first, operations second. |
| "3 levels of indentation..." | Complexity limit. Refactor design, not comments. |
| "Abstraction is not free." | Every layer costs. Earn it with current need. |
| "Nothing left to take away" | Eliminate complexity, don't manage it. |
## Integration with Beads
These principles are not separate from beads discipline:
- **Data first** → Read bead criteria before implementing
- **Evidence** → Run gates, cite output
- **Simplicity** → One bead, one scope
- **Root cause** → Trace to data model, not UI patch
- **Long-term** → Evidence before every close
**Linus built Linux. You're building with beads. Same discipline applies.**

View file

@ -0,0 +1,66 @@
# Rationalization Table
**Every excuse agents make when violating discipline. Every counter.**
## Complete Table
| Excuse | Reality | Counter |
|--------|---------|---------|
| "Just this once" | "Once" becomes "usually". Every violation compounds. | Run gates. No exceptions. |
| "We might need it later" | YAGNI. Unused abstraction = maintenance debt forever. | Delete abstraction. Add when concrete need proven. |
| "I already tested manually" | Manual ≠ reproducible. Gates exist for reason. | Run gates. Cite output. |
| "It's just display/visualization" | Display ≠ data model = two truths. Users see wrong state. | Verify display matches bd schema. |
| "Different pages, separate fixes" | Duplicated logic = two places to fail, two to maintain. | Extract shared logic. Fix once. |
| "bd is slower than direct edit" | Speed without truth = wasted time. Bugs from truth drift. | Use bd. Correctness > convenience. |
| "Typecheck never catches anything" | You don't know what it would have caught. | Run typecheck. Cite output. |
| "Lint is just style" | Style inconsistencies = maintenance burden. | Run lint. Fix violations. |
| "Tests are flaky" | Flaky tests = fix them, don't skip them. | Fix or quarantine. Don't skip gate. |
| "I'll create a bead for cleanup later" | "Later" never comes. Technical debt compounds. | Create bead NOW or cleanup NOW. |
| "This is a trivial change" | "Trivial" bugs exist. "Trivial" changes break things. | Run gates. No change is trivial. |
| "My changes don't affect types" | You don't know that. Type system knows. | Run typecheck. |
| "The abstraction is well-designed" | Unused abstraction = debt regardless of design quality. | Delete if no current concrete use. |
| "It follows best practices" | Whose practices? Why? First-principles analysis required. | Trace to physics/economics/requirements. |
| "I'll sync it properly later" | Later = never. Truth drift = bugs. | Sync now or track as blocking bead. |
| "It works on my machine" | Your machine ≠ production. Gates catch environment drift. | Run gates in CI. |
| "We can refactor later" | Later = 10x cost. Technical debt compounds. | Refactor now or create bead. |
| "This is how everyone does it" | Everyone might be wrong. First-principles required. | Analyze from fundamentals. |
| "It's about spirit not ritual" | Violating letter = violating spirit. No escape hatch. | Follow ritual. Spirit is in ritual. |
| "The deadline requires shortcuts" | Shortcuts create bugs. Bugs miss deadlines. | Run gates. Communicate realistic timeline. |
## Pressure Pattern Analysis
| Pressure | Common Rationalizations | Why It Fails |
|----------|------------------------|--------------|
| **Time** | "Just this once", "Deadline", "Gates take too long" | Bugs cost 10x gate time. |
| **Sunk Cost** | "Already spent hours", "Well-designed abstraction", "Works already" | Sunk cost is fallacy. Bad code = more cost. |
| **Exhaustion** | "Already tested manually", "Trivial change", "Run gates tomorrow" | Exhausted mistakes are worst mistakes. |
| **Authority** | "Senior said so", "Team convention", "Industry standard" | Authority can be wrong. First-principles required. |
| **Social** | "Everyone does it", "Team expects this", "Don't be difficult" | Social pressure enables mediocrity. |
## Self-Check Protocol
Before claiming any work is complete, check:
```
□ Did I use bd for all state changes?
□ Did I run typecheck? Cite output?
□ Did I run lint? Cite output?
□ Did I run tests? Cite output?
□ Did I capture UI evidence if needed?
□ Can I trace every design decision to first principles?
□ Would I accept this code from a stranger?
□ Will this make sense in 5 years?
```
**Any unchecked box = not done. Keep working.**
## The Escape Hatches (None)
| Attempted Escape | Why It Fails |
|------------------|--------------|
| "I followed the spirit" | Spirit lives in ritual. Violate ritual = violate spirit. |
| "This situation is unique" | Every situation claims uniqueness. Rules exist for uniqueness. |
| "The skill doesn't cover this" | Iron Laws cover everything. Evidence + bd + first principles. |
| "I used judgment" | Judgment without evidence = assumption. Run gates. |
**There are no escape hatches. The Iron Laws are absolute.**

View file

@ -0,0 +1,131 @@
# Verification Gates
**Required checks before ANY bead close. No exceptions.**
## Gate Sequence
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Typecheck │────▶│ Lint │────▶│ Test │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
0 errors 0 warnings All pass
0 warnings Fix or or skip
document with reason
```
## Required Commands
### All Code Changes
```bash
npm run typecheck # Must PASS with 0 errors
npm run lint # Must PASS with 0 warnings (or documented exceptions)
npm run test # Must PASS all tests
```
### UI Changes (add to above)
```bash
# Capture screenshots at all breakpoints
npm run capture:mobile # artifacts/xxx-mobile.png
npm run capture:tablet # artifacts/xxx-tablet.png
npm run capture:desktop # artifacts/xxx-desktop.png
```
### API Changes (add to above)
```bash
npm run test:api # Route integration tests
# or
node --test tests/api/
```
## Gate Failure Protocol
### Typecheck Fails
1. Fix type errors
2. Re-run typecheck
3. Only proceed when 0 errors
4. Document: "typecheck: PASS (0 errors)"
### Lint Fails
1. Fix warnings if trivial
2. If intentional violation: add eslint-disable with comment explaining WHY
3. Document in notes: "lint: PASS (0 warnings)" or "lint: PASS (1 intentional - see line 42)"
4. Never merge with unexplained lint violations
### Tests Fail
1. Analyze failure output
2. Determine: bug in code or bug in test?
3. Fix the bug (not the test to pass)
4. Re-run tests
5. Only proceed when ALL pass
6. Document: "test: PASS (47/47)"
### Flaky Tests
1. Identify flaky test
2. Options:
- Fix flakiness (preferred)
- Quarantine with .skip and create bead to fix
3. Never skip without tracking
## Evidence Format
### In Bead Notes
```bash
bd update bb-xyz --notes "Verification:
- typecheck: PASS (0 errors, 0 warnings)
- lint: PASS (0 warnings)
- test: PASS (47/47 tests in 2.3s)
- UI screenshots: artifacts/kanban-390.png, artifacts/kanban-768.png, artifacts/kanban-1440.png"
```
### In Close Reason
```bash
bd close bb-xyz --reason "Implemented X with full gate coverage. All tests passing. Screenshots captured."
```
## Gate Checklist
```
□ npm run typecheck → PASS (cite output)
□ npm run lint → PASS (cite output)
□ npm run test → PASS (cite output)
□ UI changed? → Screenshots captured (list paths)
□ API changed? → Route tests pass
□ New file? → Included in test suite
□ Notes updated? → Evidence cited
```
**Any unchecked? Don't close. Keep working.**
## Special Cases
### "No Tests Exist Yet"
1. Create tests for new code
2. Run existing test suite to ensure no regressions
3. Document: "test: PASS (existing suite), NEW: added tests for X"
### "Tests Are Slow"
1. Run them anyway
2. Consider: parallelize, optimize, cache
3. Never skip for speed
### "CI Will Catch It"
1. Run locally first
2. CI is backup, not replacement
3. Local failures = faster feedback
### "Just Documentation Change"
1. Still run typecheck (links, imports)
2. Still run lint (formatting)
3. Test may not be needed - document why skipped
## Post-Close Verification
After `bd close`:
```bash
bd show <id> # Verify status is closed
bd ready # Confirm it's not still showing as ready
```
If still shows as ready after close: `bd sync` then re-check.

View file

@ -0,0 +1,189 @@
# Workflow Engine
**The decision brain. Shared across all modes.**
## Mode Detection
When user engages, detect the mode from intent:
| User Intent | Mode | First Action |
|-------------|------|--------------|
| "What's going on?" / "What should I do?" | TRIAGE | `bd ready` |
| "Something is broken" / "Fix this bug" | DEBUG | `bd show` on related bead |
| "I need to understand..." / "How does X work?" | RESEARCH | Read code, update bead |
| "I want to design..." / "Architecture for..." | DESIGN | First-principles analysis |
| "Implement X" / "Write code for..." | IMPLEMENT | Claim bead, TDD |
| "Review this code" / "Check my work" | REVIEW | Read code against spec |
| "Simplify this" / "Clean up..." | REFACTOR | Identify debt, plan |
| "Plan the project" / "Roadmap" | PLAN | Decompose, create beads |
**If unclear, ASK the user which mode.**
## The Universal Loop
Every mode follows this pattern:
```
1. READ BEADS (what's the current truth?)
└─ bd ready / bd show / bd query
2. CHECK SKILLS (any relevant helpers?)
└─ Look for skills that match the task type
└─ Use if found, proceed without if not
3. DO WORK (mode-specific)
└─ See workflow/<mode>.md for specifics
4. WRITE BEADS (update the shared memory)
└─ bd update --notes / bd close / bd create
5. VERIFY (prove claims)
└─ Run gates appropriate to the mode
```
## Beads-as-Memory Principles
### Every Session Starts With Reading
```
NEVER start work without:
1. bd ready # What's unblocked?
2. bd show <id> # What are the details?
3. Read related closed beads for context
```
### Every Session Ends With Writing
```
NEVER end session without:
1. bd update --notes "Progress: ... Evidence: ..."
2. bd sync # Share with other agents
```
### Every Decision Is Recorded
```
When you decide something:
- Create a bead for it (if significant)
- Update existing bead notes (if related)
- Cross-reference in comments
```
### Other Agents Depend On Your Notes
```
Your notes should answer:
- What did you learn?
- What did you decide?
- What did you leave incomplete?
- What blocked you?
- What would help the next agent?
```
## The bb/bd Split
### If bb is available:
```
- Use bb agent for scope reservations
- Use bb agent for messaging other agents
- Passive activity: any bb command extends lease
```
### If bb is NOT available:
```
- Use bd slot for exclusive claims
- Use bd agent heartbeat for presence
- Skip messaging (no equivalent)
- Skip path reservations (no equivalent)
```
### Always available:
```
- bd commands (core truth)
- Verification gates
- First-principles thinking
```
## Cross-Agent Coordination
Since all agents share the same Linus personality and beads memory:
### Before Claiming Work:
```
bd ready # See what's available
bd show <id> # Check if already in_progress
bd query "status=in_progress" # Who else is working?
```
### When Claiming:
```
bd update <id> --status in_progress --notes "@<agent-id> claiming"
# Optionally: bd slot set <agent> hook <id>
# Optionally: bb agent reserve (if available)
```
### When Handing Off:
```
bd update <id> --notes "Handoff to next agent: ..."
bd update <id> --status open # Or appropriate status
# Optionally: bb agent send (if available)
```
### When Picking Up Another's Work:
```
bd show <id> # Read their notes carefully
bd query "id=<id>" --comments # Read any comments
Acknowledge previous work in your first update
```
## Skill Integration Pattern
At the start of any workflow:
```
1. Identify the task type
2. Check available skills for relevant helpers
3. If found and useful: invoke the skill
4. If not found: proceed with Linus discipline alone
5. Never hardcode specific skill dependencies
```
This keeps workflows flexible and skill-agnostic.
## Evidence Thresholds By Mode
| Mode | Minimum Evidence |
|------|------------------|
| TRIAGE | Bead status updated |
| RESEARCH | Notes with findings |
| DEBUG | Root cause identified + fix + test |
| DESIGN | Decision documented + rationale |
| IMPLEMENT | typecheck ✓ lint ✓ test ✓ |
| REVIEW | Findings documented |
| REFACTOR | typecheck ✓ lint ✓ test ✓ |
| PLAN | Beads created with dependencies |
## The Iron Laws Apply Everywhere
No mode exempts you from:
1. **BD is source of truth** - Never direct JSONL writes
2. **Evidence before assertions** - Never claim without proof
3. **First principles** - Never stop at "best practice"
## Mode Transitions
Sometimes you need to switch modes mid-work:
```
TRIAGE → IMPLEMENT : "I know what to do, now doing it"
DEBUG → RESEARCH : "Need to understand before fixing"
RESEARCH → DESIGN : "Now I understand, time to architect"
DESIGN → IMPLEMENT : "Architecture done, now build"
ANY → TRIAGE : "Lost, need to reassess"
```
On transition:
1. Update current bead notes with mode change
2. Read relevant workflow for new mode
3. Continue with fresh eyes

View file

@ -0,0 +1,105 @@
# Debug Workflow
**"Something is broken."**
## Trigger
- "Fix this bug" / "Something's broken"
- "This doesn't work" / "Error in..."
- Test failure / Unexpected behavior
## The Flow
### 1. Check Skills
```
Any relevant skills for debugging?
- Error pattern recognition skills
- System-specific diagnostic skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Find related bead (if exists)
bd query "title~=<error-keyword> OR labels~=<component>"
# Check recent changes
bd query "updated<1d AND status=closed"
# Read related bead details
bd show <related-id>
```
### 3. Reproduce & Isolate
```
First question: Can I reproduce this?
If YES:
- Isolate the minimal reproduction
- Identify the exact failure point
- Gather evidence (logs, stack traces)
If NO:
- Add logging/observability
- Create hypothesis
- Design experiment to confirm
```
### 4. Root Cause Analysis
Ask "Why?" at least 3 times:
```
Symptom: Test fails
Why 1: Function returns wrong value
Why 2: Input is malformed
Why 3: Upstream normalization missing
ROOT CAUSE: Missing normalization in caller
```
**Fix the DESIGN, not just the symptom.**
### 5. Fix Implementation
```
1. Write failing test that exposes the bug
2. Implement minimal fix
3. Verify test passes
4. Check for similar bugs elsewhere (same pattern)
```
### 6. Update Memory
```bash
# Find or create bug bead
bd create "Fix: <description>" --type bug --priority P1
# Document root cause
bd update <id> --notes "Root cause: ...
Why this was possible: ...
Fix: ...
Evidence: test added, gates pass"
# Close with evidence
bd close <id> --reason "Fixed. Root cause: X. Prevention: Y."
```
### 7. Verify
```bash
npm run typecheck && npm run lint && npm run test
```
## The Debug Questions
1. What is the symptom?
2. Can I reproduce it?
3. Where does it fail?
4. Why does it fail there?
5. Why was this possible? (design flaw)
6. Does the same flaw exist elsewhere?
## Prevention Mindset
Linus doesn't just fix bugs. Linus eliminates bug CLASSES.
After every fix, ask:
- What design flaw allowed this?
- How do I prevent the entire class?
- Is there a pattern to search for?
Update bead with prevention notes for future reference.

View file

@ -0,0 +1,128 @@
# Design Workflow
**"I need to architect something."**
## Trigger
- "Design a system for..."
- "Architecture for..."
- "How should we structure..."
- "We need to build X, how?"
## The Flow
### 1. Check Skills
```
Any relevant skills for design?
- Architecture pattern skills
- Domain modeling skills
- First-principles thinking skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Check for existing design decisions
bd query "labels~=design OR labels~=architecture"
# Check for related work
bd query "title~=<component>"
# Read constraints from parent/related beads
bd show <related-id>
```
### 3. First-Principles Analysis
```
Start with requirements, not solutions.
Questions:
1. What problem are we solving? (not what are we building)
2. What are the hard constraints? (physics, economics, requirements)
3. What are the soft constraints? (preferences, conventions)
4. What would the simplest solution look like?
5. Why isn't that enough?
```
### 4. Explore Trade-offs
```
For each design option:
- What does it make easy?
- What does it make hard?
- What can't it do?
- What complexity does it add?
```
### 5. Make Decisions
```
Document:
- What you decided
- Why you decided it
- What you rejected and why
- What's still open
```
### 6. Update Memory
```bash
# Create design bead
bd create "Design: <topic>" --type task --priority P1
bd update <id> --notes "## Problem
<what problem we're solving>
## Constraints
- Hard: <immutable constraints>
- Soft: <flexible constraints>
## Decision
<what we decided>
## Rationale
<why this decision>
## Alternatives Considered
- X: rejected because Y
- Z: rejected because W
## Open Questions
<things still undecided>
## Implementation Notes
<hints for implementer>"
# If design is complete and approved
bd close <id> --reason "Design complete. Decision: X. Rationale: Y."
```
## Design Documentation
Every design should answer:
1. **Problem** - What are we solving?
2. **Constraints** - What can't we change?
3. **Decision** - What are we doing?
4. **Rationale** - Why this way?
5. **Alternatives** - What else did we consider?
6. **Trade-offs** - What do we gain/lose?
7. **Risks** - What could go wrong?
## Simplicity Test
Before finalizing:
```
Can I explain this to a new team member in 5 minutes?
If not, it's too complex.
Can I remove anything without breaking it?
If yes, remove it.
Does this solve the ACTUAL problem or an imagined one?
Go back to requirements if unsure.
```
## For Implementers
Your design notes should let an implementer:
- Understand what to build
- Know the constraints
- Make localized decisions without revisiting architecture
- Test that they built the right thing

View file

@ -0,0 +1,146 @@
# Implement Workflow
**"I need to write code."**
## Trigger
- "Implement X"
- "Write code for..."
- "Build this feature"
- "Add support for..."
## The Flow
### 1. Check Skills
```
Any relevant skills for implementation?
- Language/framework skills
- Testing skills
- Code generation skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Find or claim the bead
bd ready
bd show <id>
# Read design decisions
bd query "labels~=design AND title~=<feature>"
# Read related closed beads for patterns
bd query "status=closed AND labels~=<area>"
```
### 3. Claim the Work
```bash
bd update <id> --status in_progress --notes "Plan:
1. <step 1>
2. <step 2>
...
Acceptance: <from bead>"
```
### 4. Test-First Implementation
```
For each piece of behavior:
1. Write failing test
2. Run test, capture failure
3. Implement minimal code to pass
4. Run test, verify pass
5. Refactor if needed
```
### 5. Update Progress
```bash
# After each meaningful progress
bd update <id> --notes "Progress:
- <X> complete, evidence: <test name>
- <Y> in progress
- <Z> blocked by: <blocker>"
```
### 6. Verify Gates
```bash
npm run typecheck && npm run lint && npm run test
```
All must pass before closing.
### 7. Close with Evidence
```bash
bd update <id> --notes "Evidence:
- typecheck: PASS
- lint: PASS
- test: PASS (N/N)
- Files changed: <list>
- Coverage: <if relevant>"
bd close <id> --reason "Implemented with verification"
bd sync
```
## Implementation Principles
### Small Steps
```
One behavior at a time.
One file at a time when possible.
Commit after each working state.
```
### No Speculation
```
Don't build for imagined future.
Build for current concrete need.
If future need arises, extend then.
```
### Evidence Every Claim
```
"I added X" → Which test proves it?
"I fixed Y" → Which test was failing?
"It works" → Show the output.
```
## Blocked?
```bash
bd update <id> --notes "BLOCKED: <what>
Reason: <why>
Needs: <what would unblock>
Next agent: <handoff notes>"
# If creating a blocker bead
bd create "<blocker description>" --type task
bd dep add <current-id> <blocker-id>
```
## Multi-Agent Implementation
If another agent might continue:
```bash
bd update <id> --notes "Handoff:
## Completed
- X, Y, Z done
## In Progress
- A partially done (see file:line)
## Remaining
- B, C still needed
## Gotchas
- <non-obvious things learned>
- <patterns to follow>"
```
## The Gates Are Non-Negotiable
Never close without:
- `npm run typecheck` → PASS
- `npm run lint` → PASS
- `npm run test` → PASS
No exceptions. No "just this once". No "it's obvious".

View file

@ -0,0 +1,126 @@
# Plan Workflow
**"Let's figure out what needs to be done."**
## Trigger
- "Plan the project" / "Create a roadmap"
- "Break this down" / "What are the steps?"
- "How should we approach..."
- Starting a new epic/initiative
## The Flow
### 1. Check Skills
```
Any relevant skills for planning?
- Domain decomposition skills
- Dependency analysis skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Check for existing related work
bd query "labels~=<area>"
# Check for constraints/decisions
bd query "labels~=design OR labels~=decision"
```
### 3. First-Principles Decomposition
```
Start with the goal, work backward:
1. What's the end state?
2. What needs to be true for that?
3. What's the minimal path there?
4. What are the dependencies?
5. What can be parallelized?
```
### 4. Create Bead Structure
```bash
# Create epic
bd create "<Epic Name>" --type epic --priority P1
# Create children with dependencies
bd create "<Task 1>" --type task --priority P1
bd create "<Task 2>" --type task --priority P1
bd dep add <task2-id> <task1-id> # Task 2 depends on Task 1
# Document the plan
bd update <epic-id> --notes "## Goal
<what we're achieving>
## Approach
<high-level strategy>
## Phases
1. <phase 1>: <tasks>
2. <phase 2>: <tasks>
## Parallelization
<what can run in parallel>
## Risks
<what could go wrong>
## Success Criteria
<how we know we're done>"
```
### 5. Validate Structure
```bash
# Check for cycles
bd dep cycles
# Check dependencies are correct
bd dep tree <epic-id>
# Validate parallel paths
bd ready # Should show unblocked beads
```
## Planning Principles
### Dependency Direction
```
Dependencies = execution order
NOT visual order or "nice to have"
A → B means: A must complete before B can start
```
### Minimal Dependencies
```
Add dependency only if:
- Blocked task CANNOT proceed without blocker
- Real hard dependency, not soft preference
Over-chaining kills parallelization.
```
### Priorities
```
P0: Critical, blocking everything
P1: Important, on the critical path
P2: Valuable, can wait briefly
P3: Nice to have, defer
```
## Good Plans
- **Clear goal** - Anyone can see what success looks like
- **Decomposed tasks** - Each task is doable in one session
- **Correct dependencies** - Execution order is explicit
- **Parallelization** - Independent work is visible
- **Risks identified** - Known unknowns are documented
- **Acceptance criteria** - Each task has clear completion
## For Other Agents
Your plan should let any agent:
- Understand the overall goal
- Pick up any ready task and go
- Know what depends on their work
- See where they fit in the bigger picture

View file

@ -0,0 +1,123 @@
# Refactor Workflow
**"Simplify this mess."**
## Trigger
- "Clean up X" / "Simplify..."
- "Refactor this" / "This is messy"
- Technical debt identified
- Code smell detected
## The Flow
### 1. Check Skills
```
Any relevant skills for refactoring?
- Language-specific refactoring patterns
- Debt identification skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Check for related debt beads
bd query "labels~=debt OR labels~=refactor"
# Check for recent changes that might inform
bd query "updated<7d AND notes~=<component>"
```
### 3. Identify Debt
```
What's the problem?
- Duplication? → Extract shared logic
- Wrong abstraction? → Replace with simpler
- Missing abstraction? → Add minimal one
- Dead code? → Delete
- Unclear names? → Rename
- Hidden dependencies? → Make explicit
```
### 4. Plan the Change
```bash
bd create "Refactor: <what>" --type task --priority P2
bd update <id> --notes "Debt identified:
<what's wrong>
Plan:
1. <step 1>
2. <step 2>
...
Scope: <what files/modules>
Risk: <what could break>
Tests to run: <which verify behavior preserved>"
```
### 5. Refactor Safely
```
CRITICAL: Behavior must NOT change.
1. Ensure tests exist for current behavior
- If not, write characterization tests first
2. Make one small change at a time
3. Run tests after each change
4. Never change behavior AND structure simultaneously
```
### 6. Verify
```bash
npm run typecheck && npm run lint && npm run test
```
All must pass. Behavior preserved.
### 7. Document Result
```bash
bd update <id> --notes "Refactored:
- Before: <complexity measure>
- After: <complexity measure>
- Files changed: <list>
- Tests: PASS (behavior preserved)"
bd close <id> --reason "Refactored. Complexity reduced."
```
## Refactoring Rules
1. **Never refactor without tests**
- If no tests, write characterization tests first
- Tests prove behavior is preserved
2. **One change at a time**
- Rename → test → commit
- Extract → test → commit
- Never combine refactors
3. **No behavior changes**
- Refactor = structure change only
- Behavior changes = separate task
4. **Delete > Simplify > Abstract**
- Can I delete it? Do it.
- Can I simplify it? Do it.
- Must I abstract? Do it minimally.
## Simplicity Questions
After refactoring:
- Is there less code? (good)
- Is there more code? (justify it)
- Are there fewer files? (good)
- Are there fewer abstractions? (good)
- Is it easier to understand? (must be yes)
## For Future Agents
Your refactor notes should explain:
- Why the old way was bad
- Why the new way is better
- What you considered but rejected
- Any remaining debt

View file

@ -0,0 +1,91 @@
# Research Workflow
**"I need to understand something."**
## Trigger
- "How does X work?"
- "Explain the architecture of..."
- "I need to understand..."
- "What's the current state of..."
## The Flow
### 1. Check Skills
```
Any relevant skills for this research?
- Code exploration skills
- Documentation skills
- Domain-specific knowledge skills
- Use if helpful, skip if not
```
### 2. Read Existing Knowledge
```bash
# Check if already documented in beads
bd query "title~=<topic> OR notes~=<topic>"
# Check for closed beads with findings
bd query "status=closed AND notes~=<topic>"
# Read relevant bead notes
bd show <related-id>
```
### 3. Explore Codebase
```
- Find entry points
- Trace data flows
- Identify key abstractions
- Note patterns and conventions
```
### 4. Document Findings
Two paths:
**If significant:**
```bash
bd create "Research: <topic>" --type task --priority P2
bd update <id> --notes "Findings:
## Summary
## Key Components
## Data Flow
## Patterns Observed
## Open Questions"
```
**If related to existing bead:**
```bash
bd update <existing-id> --notes "Research findings:
<findings>"
```
### 5. Identify Gaps
```
What's still unclear?
What needs investigation?
What decisions need to be made?
```
## Research Outputs
Document:
- **What you learned** (facts)
- **How things connect** (relationships)
- **What's unclear** (gaps)
- **What should change** (opportunities)
- **Where to look next** (pointers)
## For Future Agents
Your research notes should let another agent:
- Understand the topic without re-researching
- Know what's known vs unknown
- Continue from where you stopped
- Make informed decisions
## Evidence
Research doesn't need test gates, but does need:
- Clear documentation
- Cited sources (file paths, line numbers)
- Dated findings (when was this true?)

View file

@ -0,0 +1,118 @@
# Review Workflow
**"Review this code."**
## Trigger
- "Review this code" / "Check my work"
- "Is this correct?" / "What do you think?"
- Pull request review
- Pre-commit review
## The Flow
### 1. Check Skills
```
Any relevant skills for review?
- Language-specific review skills
- Security review skills
- Performance review skills
- Use if helpful, skip if not
```
### 2. Read Context
```bash
# Find the related bead
bd show <id>
# Read acceptance criteria
# Read design decisions
# Read constraints
```
### 3. Review Against Spec
```
Does the code:
- Meet the acceptance criteria?
- Follow the design decisions?
- Respect the constraints?
- Solve the stated problem?
```
### 4. Review Against Standards
```
Linus-grade review checks:
Correctness:
- Does it do what it claims?
- Are edge cases handled?
- Are error paths covered?
Simplicity:
- Is there unnecessary complexity?
- Can anything be removed?
- Is the abstraction justified?
Safety:
- Can this break existing code?
- Are there security implications?
- Can this cause data loss?
Performance:
- Is there unnecessary work?
- Are there N+1 queries?
- Is memory managed correctly?
```
### 5. Document Findings
```bash
# If findings exist
bd update <id> --notes "Review findings:
## Must Fix (blocking)
- <critical issue>
## Should Fix (non-blocking)
- <improvement>
## Nitpicks (optional)
- <minor style/readability>
## Good
- <what's done well>"
# If approved
bd update <id> --notes "Review: APPROVED
- All acceptance criteria met
- No blocking issues
- Ready for merge"
```
## Review Questions
For every piece of code:
1. What does it do? (if unclear, flag it)
2. Why does it do it this way? (if unclear, flag it)
3. What could go wrong? (if something, flag it)
4. Is this the simplest solution? (if not, flag it)
## Feedback Style
```
BAD: "This is wrong"
GOOD: "This doesn't handle X case, which happens when Y"
BAD: "Bad pattern"
GOOD: "This pattern makes X harder. Consider Y instead because Z."
BAD: "LGTM"
GOOD: "Reviewed. Acceptance criteria met. No blocking issues found."
```
## Kernel-Grade Rigor
Linus reviews:
- Every line matters
- Every abstraction must earn its place
- Every complexity must justify itself
- Every assumption must be validated
Not mean, but demanding. Code lives a long time.

View file

@ -0,0 +1,68 @@
# Triage Workflow
**"What should I work on?"**
## Trigger
- "What's up?" / "What's going on?" / "What should I do?"
- "Yo" / "Hey" / Any session start
- "What's the status?"
## The Flow
### 1. Read Current State
```bash
bd ready # What's unblocked?
bd query "status=in_progress" # What's currently being worked on?
```
### 2. Analyze Options
- Look at priority (P0 > P1 > P2 > P3)
- Look at blockers (ready vs blocked)
- Look at dependencies (what unblocks others?)
- Consider your strengths (if known)
### 3. Check Skills
```
Any relevant skills for the available work?
- Check for skills matching task type
- Use if helpful, skip if not
```
### 4. Recommend or Claim
Either:
- **Recommend**: "Next best bead is X because Y"
- **Claim**: Update bead to in_progress with plan
### 5. Update Memory
```bash
# If recommending
bd update <id> --notes "Recommended for next agent: ..."
# If claiming
bd update <id> --status in_progress --notes "@<agent> claiming. Plan: ..."
```
## Decision: Recommend vs Claim
| Recommend When | Claim When |
|----------------|------------|
| Multiple agents available | You're the only one |
| Uncertain if right fit | Clear fit for your skills |
| Need human decision | Clear path forward |
| High-stakes work | Routine work |
## Handoff Protocol
If work was previously in_progress by another agent:
1. Read their notes carefully: `bd show <id>`
2. Check for handoff notes
3. Acknowledge their work in your first update
4. Continue from where they left off
## Output
End triage with:
- Clear next bead identified
- Why it's the right choice
- Any blockers or dependencies noted
- Memory updated