What Are Decision Graphs?
Decision graphs capture the reasoning behind code changes as a structured, queryable graph. Instead of just storing “what changed,” Loom tracks:- Goals - What you’re trying to achieve
- Decisions - Choices made during development
- Options - Alternatives considered
- Actions - Concrete steps taken
- Outcomes - Results and observations
Node Types
Decision graphs consist of typed nodes connected by edges:Node Types
| Type | Purpose | Example |
|---|---|---|
goal | High-level objective | ”Add authentication to the API” |
decision | A choice that was made | ”Use JWT tokens instead of sessions” |
option | Alternative considered | ”Considered OAuth2 but too complex for v1” |
action | Concrete task or change | ”Implement JWT middleware” |
outcome | Result of an action | ”Auth working but token refresh needed” |
observation | Learning or insight | ”Token expiry should be configurable” |
revisit | Decision to reconsider | ”Revisit OAuth2 for v2 with SSO support” |
Edge Types
Edges define relationships between nodes:| Type | Meaning | Example |
|---|---|---|
leads_to | Causal relationship | Goal → Action |
chosen | Selected option | Decision → Option |
rejected | Dismissed option | Decision → Option (rejected) |
requires | Dependency | Action → Action |
blocks | Blocker | Issue → Action |
enables | Enabler | Action → Goal |
supersedes | Replacement | New Decision → Old Decision |
Data Model
DecisionNode Schema
DecisionEdge Schema
Core API
TheLoom.Decisions.Graph module provides the primary API:
Creating Nodes
Creating Edges
Querying
Superseding Decisions
- Creates a
:supersedesedge - Updates the old node’s status to
:superseded - Wraps both operations in a transaction
Context Injection
Decision graphs are automatically injected into the system prompt via the ContextWindow.How It Works
Context Format
The injected context is structured markdown:Token Budget
Decision context is allocated a fixed token budget (default: 1024 tokens):[truncated...].
Narrative Timelines
TheLoom.Decisions.Narrative module builds chronological views:
Session Timeline
Goal Timeline
Pulse Reports
TheLoom.Decisions.Pulse module generates health reports:
Coverage Gaps
Identifies goals that lack concrete actions or outcomes:Stale Nodes
Finds active nodes unchanged for 7+ days (configurable):Example Workflow
Here’s how a decision graph might evolve during development:Visualization
Decision graphs can be visualized using tools like:- Mermaid.js - Render graphs in documentation
- Graphviz - Generate PNG/SVG diagrams
- Neo4j - Import for advanced graph queries (future)
Mermaid Example
Best Practices
Keep titles concise
Keep titles concise
Use 5-10 words for node titles. Put details in the
description field.✅ Good: “Use JWT tokens for auth”❌ Bad: “After evaluating several authentication approaches including session-based auth, OAuth2, and JWT tokens, we decided to…”Use confidence scores
Use confidence scores
Track uncertainty with the
confidence field (0-100).- 90-100% - Very confident, well-researched
- 70-89% - Confident, but some unknowns
- 50-69% - Moderate confidence, needs validation
- Below 50% - Low confidence, experimental
Record rejected options
Record rejected options
Document why options were rejected. This prevents re-exploring dead ends.
Link decisions to sessions
Link decisions to sessions
Associate decisions with the session where they were made:This enables session-scoped queries and context injection.
Use metadata for extensibility
Use metadata for extensibility
Store arbitrary data in the
metadata field:Future Enhancements
- Automatic extraction - Parse decisions from commit messages
- Similarity search - Find related past decisions using embeddings
- Decision templates - Pre-structured patterns (e.g., “API design decision”)
- Export/import - Share decision graphs across projects
- Analytics - Track decision quality, confidence trends, outcome success rates
Next Steps
Architecture
Understand where decision graphs fit in the system
Context Window
Learn how decisions are injected into prompts