sudocode
CLAUDE.md293 starsChanged 12 months agoApache-2.0View on GitHub
sudocode is a git-native context management system for AI-assisted software development. It provides a 4-tiered abstraction structure: Core Value Proposition: Treats context as code: git-tracked, distributed, mergeable. Package Dependencies: - types → standalone (no deps) - cli → depends on types - mcp → depends on cli (wraps via child_process) - server → depends on cli - frontend → independent (talks to server via REST/WS) Test Organization: - Frontend: tests/components/, tests/pages/, tests/hooks/, tests/contexts/ - Backend: tests/unit/, tests/integration/ - Naming: *.test.ts…
In this repositoryOne other file it gives its agents.
- sudocodeSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 93
Follow-ups: parent_execution_id links execution chains together
- Distinctive: line 272
Follow-up shares worktree with root (continues from same state)
- Very specific: line 523
Provide feedback: Use add_feedback MCP tool when closing issues that implement specs
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sudocode Repository Guide for AI Coding Agents
Project Overview
sudocode is a git-native context management system for AI-assisted software development. It provides a 4-tiered abstraction structure:
- Spec - User intent and requirements (WHAT you want)
- Issue - Agent-scoped work items (Tasks within agent scope)
- Execution - Agent run trajectory (HOW it was executed)
- Artifact - Code diffs and output (Results)
Core Value Proposition: Treats context as code: git-tracked, distributed, mergeable.
Monorepo Structure
sudocode/
├── types/ # Shared TypeScript definitions (build first)
├── cli/ # CLI (@sudocode-ai/cli) - core operations
├── mcp/ # MCP server (@sudocode-ai/mcp) - wraps CLI
├── server/ # Local backend (@sudocode-ai/local-server) - executions + API
├── frontend/ # React UI (@sudocode-ai/local-ui) - web interface
├── sudocode/ # Meta-package (bundles all)
└── .sudocode/ # Example project data (self-hosting)Package Dependencies:
types→ standalone (no deps)cli→ depends ontypesmcp→ depends oncli(wraps via child_process)server→ depends onclifrontend→ independent (talks to server via REST/WS)
Build & Test
npm run build # Build all packages
npm run test # Run all tests
npm --prefix <pkg> test -- --run # Package-specific tests
npm --prefix <pkg> test -- --run tests/path/to/file.test.tsTest Organization:
- Frontend:
tests/components/,tests/pages/,tests/hooks/,tests/contexts/ - Backend:
tests/unit/,tests/integration/ - Naming:
*.test.ts(unit),*.test.tsx(React components)
Core Architecture
Storage: Distributed Git Database
Markdown Files (.sudocode/specs/*.md)
↕ (syncs via watcher)
JSONL Files (specs.jsonl, issues.jsonl) ← git-tracked
↕ (import/export)
SQLite Cache (cache.db) ← QUERY ENGINE (gitignored, rebuilt from JSONL)Source of Truth Configuration (config.json):
"sourceOfTruth": "jsonl"(default) - JSONL files are authoritative, markdown is derived"sourceOfTruth": "markdown"- Markdown files are authoritative, JSONL is derived
Key Principles:
- Configurable source of truth - Choose between JSONL or Markdown as authoritative
- JSONL always exported - For git tracking, regardless of source of truth mode
- SQLite is query cache - Gitignored, rebuilt after
git pull - Markdown is human interface - Can be authoritative or derived based on config
- Git handles distribution - AI handles merge conflicts
Data Model
| Entity | ID Format | Purpose | Key File |
| Spec | s-xxxx | User intent, requirements | types/src/index.d.ts |
| Issue | i-xxxx | Actionable work for agents |
- Storage: JSONL (markdown optional)
- Status: blocked/open → in_progress → needs_review/closed
Execution (Agent Run)
- Purpose: Track agent execution on an issue
- Agent Types: claude-code, codex, copilot, cursor
- Status: preparing → pending → running → paused/completed/failed/cancelled/stopped
- Captures: Git commits, logs, exit code, files changed, session_id
- Modes: worktree (isolated), local (in-place)
- Workflow Support:
workflow_execution_id,step_type,step_index,step_configfor multi-step chains - Follow-ups:
parent_execution_idlinks execution chains together
IssueFeedback (Implementation → Requirements Loop)
- Purpose: Issues provide anchored feedback on specs or other issues
- Types: comment, suggestion, request
- Anchoring: Line-based with smart relocation (LocationAnchor → FeedbackAnchor)
- Polymorphic:
from_id(issue) →to_id(spec or issue) - Bidirectional: Closes loop from implementation back to requirements
Relationship (Graph Edges)
- Types:
blocks,implements,depends-on,references,discovered-from,related - Polymorphic: Can link any entity types (spec→spec, issue→issue, issue→spec)
- Bidirectional: Tracked in both directions
ID Generation
- Hash-based IDs:
s-xxxx(specs),i-xxxx(issues)- Generated from:
${entityType}-${title}-${timestamp} - 4-8 characters, collision-resistant, git-merge friendly
- Generated from:
- UUIDs: Each entity has both
id(hash) anduuid(UUID v4)uuidused for distributed sync/deduplicationidused for user-facing references
Cross-References in Markdown
[[s-abc123]] # Spec reference
[[@i-xyz]] # Issue reference
[[s-abc123|Display]] # With display text
[[i-xyz]]{ blocks } # With relationship typeExtracted via regex, creates bidirectional relationships automatically.
Key Concepts
- Execution Chains: Root execution + follow-ups via
parent_execution_id - Worktree Isolation: Each execution gets isolated git worktree
- Multi-Agent: Supports claude-code, codex, copilot, cursor (see
types/src/agents.d.ts) - Polymorphic Feedback: Issues can provide feedback on specs OR other issues
Key Files by Package
types/
src/index.d.ts- Core entity interfaces (Spec, Issue, Execution, Feedback)src/schema.ts- SQLite schema definitionssrc/agents.d.ts- Agent configuration typessrc/artifacts.d.ts- Execution change tracking typessrc/migrations.ts- Database migrations
cli/
src/operations/*.ts- Core CRUD operations (specs, issues, relationships, feedback)src/jsonl.ts- JSONL read/write with atomic operationssrc/markdown.ts- Markdown parsing, frontmatter, cross-referencessrc/watcher.ts- File system watcher for auto-sync
server/
src/services/execution-service.ts- Execution orchestrationsrc/services/execution-changes-service.ts- Code change trackingsrc/services/worktree-sync-service.ts- Worktree sync (squash/preserve/stage)src/services/agent-registry.ts- Multi-agent discoverysrc/adapters/- Agent adapters (claude, codex, copilot, cursor)src/execution/- Execution engine, worktree management
mcp/
src/server.ts- MCP tool definitions (wraps CLI)
frontend/
src/pages/- ExecutionsPage, WorktreesPage, IssuesPage, SpecsPagesrc/components/executions/- ExecutionView, AgentTrajectory, CodeChangesPanelsrc/hooks/- useExecutions, useExecutionChanges, useExecutionSync, useAgents
API Reference
CLI Commands
sudocode init # Initialize .sudocode directory
sudocode spec create|list|show|update # Spec management
sudocode issue create|list|show|update # Issue management
sudocode link <from> <to> --type=<type> # Create relationship
sudocode ready # Show ready work (no blockers)
sudocode sync [--watch] # Sync JSONL ↔ SQLite
sudocode feedback add # Add anchored feedback
sudocode server start # Start local serverMCP Tools (from mcp/src/server.ts)
ready- Get project status and ready worklist_issues,show_issue,upsert_issue- Issue operations (upsert supportsparentfor hierarchy)list_specs,show_spec,upsert_spec- Spec operationslink- Create relationships (blocks, implements, depends-on, references, discovered-from, related)add_reference- Insert cross-references in markdownadd_feedback- Provide anchored feedback on specs or issues (polymorphicto_id)
Server API Endpoints (from server/src/index.ts)
# Entity CRUD
GET/POST /api/issues, /api/specs, /api/relationships, /api/feedback
# Execution Lifecycle
POST /api/issues/:id/executions # Start execution
GET /api/executions/:id/chain # Get execution chain
GET /api/executions/:id/stream # SSE stream
POST /api/executions/:id/follow-up # Create follow-up
POST /api/executions/:id/stop # Cancel
# Code Changes
GET /api/executions/:id/changes # File change stats
GET /api/executions/:id/changes/file # Individual file diff
# Worktree Sync
GET /api/executions/:id/sync/preview # Preview (conflicts, diff)
POST /api/executions/:id/sync/squash # Squash commits
POST /api/executions/:id/sync/preserve # Preserve history
POST /api/executions/:id/sync/stage # Stage without commit
# Other
GET /api/agents # Available agents
WS /ws # Real-time updatesImplementation Patterns
Pattern 1: JSONL Source of Truth
- One JSON object per line
- Sorted by
created_at(minimizes merge conflicts) - Atomic writes via temp file + rename
- File mtime set to newest
updated_at
Pattern 2: Dual Representation (Markdown + JSONL)
- User edits .md → watcher → parse → update JSONL → update SQLite
- CLI updates SQLite → debounced export → update JSONL
- Git pull → JSONL changed → import → rebuild SQLite
Pattern 3: Feedback Anchoring
- Captures: line number, section heading, text snippet, context (3 lines before/after)
- Auto-relocation algorithm when spec changes:
- Try exact line match
- Try text snippet match
- Try section heading match
- Mark as stale if all fail
- Status:
valid|relocated|stale
Pattern 4: Git Worktree Isolation
- Each execution gets isolated worktree
- Auto-creates branch:
sudocode/exec-<id> - Parallel execution without conflicts
- Auto-cleanup on completion (configurable)
- Orphaned worktree cleanup on server startup
Pattern 5: Multi-Agent Architecture
- Agent adapters abstract different AI coding agents (Claude, Codex, Copilot, Cursor)
- Agent registry discovers and verifies executables (24-hour cache)
- Each adapter handles agent-specific CLI args and output parsing
- Normalized entry format standardizes output across agents
- Agent configs are type-safe per agent type (ClaudeCodeConfig, CodexConfig, etc.)
Pattern 6: Worktree Sync Modes
Four sync strategies to merge worktree changes back to main:
- Preview: Non-destructive preview showing conflicts, diffs, commits
- Squash: Combines all worktree commits into single commit on target
- Preserve: Merges preserving full commit history
- Stage: Applies changes to working directory without committing
Features:
- JSONL conflict auto-resolution via three-way merge
- Safety snapshots via git tags for rollback
- Uncommitted change tracking and optional inclusion
- Handles deleted worktrees gracefully
Pattern 7: Execution Chains
- Root execution linked to follow-up executions via
parent_execution_id - Execution chains track cumulative code changes
- Follow-up shares worktree with root (continues from same state)
- Change calculation traverses chain to find root
before_commit
Agent Configuration
Claude Code (claude-code)
Most full-featured agent with extensive configuration options:
{
type: "claude-code",
model?: string, // e.g., "claude-sonnet-4-20250514"
systemPrompt?: string, // Custom system prompt
appendSystemPrompt?: string, // Append to default system prompt
allowedTools?: string[], // ["Read", "Write", "Bash", "Glob", "Grep", "Edit"]
disallowedTools?: string[], // Tools to disable
mcpServers?: object, // MCP server configuration
permissions?: {
allowedDirectories?: string[],
disallowedDirectories?: string[]
}
}Codex (codex)
OpenAI Codex CLI integration:
{
type: "codex",
model?: string, // e.g., "gpt-4"
fullAuto?: boolean, // Auto-approve all operations (default: true)
sandbox?: string // Sandbox mode
}Copilot (copilot)
GitHub Copilot CLI integration:
{
type: "copilot",
model?: string // Model selection
}Cursor (cursor)
Cursor IDE agent:
{
type: "cursor",
model?: string, // Model selection
forceMode?: boolean // Force mode for automated execution
}Project Configuration
Configuration is split into two files:
Project Config (.sudocode/config.json) - Git-tracked
Shared project settings that should be version controlled.
{
"sourceOfTruth": "jsonl"
}| Key | Values | Description |
sourceOfTruth | "jsonl" (default), "markdown" | Which files are authoritative for entity data |
Local Config (.sudocode/config.local.json) - Gitignored
Machine-specific settings that vary per developer.
{
"worktree": {
"worktreeStoragePath": ".sudocode/worktrees",
"autoCreateBranches": true,
"autoDeleteBranches": false,
"enableSparseCheckout": false,
"branchPrefix": "sudocode",
"cleanupOrphanedWorktreesOnStartup": true
},
"editor": {
"editorType": "vs-code"
}
}Config CLI Commands
sudocode config get [key] # Show all config or specific key
sudocode config set <key> <value> # Set config value
sudocode config show # Show source of truth infoDatabase Schema
Core Tables
specs # Spec metadata and content
issues # Issue metadata, status, assignee
relationships # Entity relationships (polymorphic)
issue_feedback # Anchored feedback (from_id → to_id, supports issue→spec and issue→issue)Execution Tables
executions # Execution lifecycle, git info, workflow fields
# Key fields: issue_id, agent_type, status, mode,
# parent_execution_id (chains), workflow_execution_id,
# step_type, step_index, step_config,
# before_commit, after_commit, worktree_path
execution_logs # Raw and normalized execution output
# raw_logs: Legacy JSONL format
# normalized_entry: Structured NormalizedEntry objectsSupporting Tables
prompt_templates # Reusable execution prompts (issue|spec|custom types)
events # Event log for auditingKey Indexes
idx_executions_issue (issue_id)
idx_executions_status (status)
idx_executions_workflow (workflow_execution_id)
idx_executions_workflow_step (workflow_execution_id, step_index)
idx_feedback_from (from_id)
idx_feedback_to (to_id)Frontend Architecture
Key Pages
- ExecutionsPage - Multi-execution grid view with filtering and pagination
- ExecutionDetailPage - Execution chain view with follow-ups inline
- WorktreesPage - Worktree management with sync dialogs
- IssuesPage, SpecsPage - Entity list and detail views
- ArchivedIssuesPage - View archived issues with feedback
Key Components
Execution Management:
ExecutionChainTile- Compact tile for grid viewExecutionsGrid- CSS Grid container for multiple chainsExecutionsSidebar- Filtering, visibility, status displayExecutionView- Full detail view with follow-up chainExecutionMonitor- Real-time status monitoringFollowUpDialog- Create follow-up executionsAgentTrajectory- Visualize agent tool calls and actions
Code Changes:
CodeChangesPanel- File list with change stats (A/M/D/R)DiffViewer- Unified diff rendering via @git-diff-view/reactCommitChangesDialog- Commit worktree changesSyncPreviewDialog- Preview sync before execution
Agent Configuration:
AgentConfigPanel- Agent selection and configurationAgentSelector- Dropdown for agent typesClaudeCodeConfigForm,CodexConfigForm, etc. - Agent-specific forms
Worktree Management:
WorktreeList- List all worktrees with search/filterWorktreeCard- Individual worktree displayWorktreeDetailPanel- Detail panel with sync options
Key Hooks
Execution:
useExecutions- Fetch root executions with React Query + WebSocketuseExecutionChanges- Get file changes (committed + uncommitted)useExecutionSync- Manage sync operations (preview, squash, preserve, stage)useExecutionLogs- Stream execution logs in real-timeuseAgUiStream- Parse ag-ui output stream
Agent:
useAgents- Fetch available agentsuseAgentActions- Compute contextual actions based on execution state
Worktree:
useWorktrees- Fetch and manage worktreesuseWorktreeMutations- Create, update, delete worktrees
Entity:
useFeedback,useFeedbackPositions- Feedback managementuseIssueHoverData,useSpecHoverData- Hover card data
Contexts
- WebSocketContext - Real-time message subscription with project-aware handling
Quick Reference
Storage Layout
.sudocode/
├── specs/ # Markdown files (git-tracked)
├── specs.jsonl # Spec data (git-tracked)
├── issues/ # Markdown files (git-tracked)
├── issues.jsonl # Issue data (git-tracked)
├── config.json # Project config (git-tracked)
├── config.local.json # Local config (gitignored)
├── cache.db # SQLite cache (gitignored)
└── worktrees/ # Execution isolation (gitignored)Relationship Types
blocks | implements | depends-on | references | discovered-from | related
Status Lifecycles
- Issue: open → in_progress → blocked/needs_review → closed
- Execution: preparing → pending → running → paused/completed/failed/cancelled/stopped
Agent Types
claude-code | codex | copilot | cursor (configs in types/src/agents.d.ts)
Sync Modes
preview | squash | preserve | stage
Working with sudocode
This project uses sudocode for its own management. When working on issues:
- Check ready work:
sudocode ready - Claim issue:
sudocode issue update <id> --status=in_progress - Check context:
sudocode spec show <id>orsudocode issue show <id> - Provide feedback: Use
add_feedbackMCP tool when closing issues that implement specs - Close issue:
sudocode issue close <id>
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

