Spec-driven traceability CLI for software projects
Project description
specgraph
Spec-driven traceability CLI for software projects.
Tracks the links between specs, tickets, code, and tests. Zero dependencies (Python 3.10+ stdlib only).
Vibe codedAgentically developed with love with Claude Code.
Why
Most project management tools track tasks. specgraph tracks the traceability graph — which spec section led to which ticket, which ticket links to which code, and where the gaps are.
Spec (what to build)
-> Tickets (work items)
-> Code (implementation)
-> Tests (proof it works)
specgraph answers questions like:
- "What spec covers this code?" (
specgraph trace path/to/file.py) - "Which specs have no implementation tickets?" (
specgraph gaps) - "What code is orphaned — not linked from any ticket?" (
specgraph orphans) - "How complete is this spec?" (
specgraph completeness my-spec)
Install
# With uv (recommended):
uv tool install specgraph
# With pipx:
pipx install specgraph
# Or just clone and run directly:
python3 path/to/specgraph/src/specgraph/__init__.py ls
Quick Start
1. Add specgraph.yaml to your project root
# specgraph.yaml - minimal config
tickets_dir: .tickets
specs_dir: docs/spec
2. Create the directory structure
your-project/
├── specgraph.yaml
├── .tickets/
│ ├── TEMPLATE.md # Optional: ticket template
│ └── impl/ # Implementation tickets
│ └── my-feature/
│ └── README.md
├── docs/
│ └── spec/
│ └── MY_FEATURE.md # Specs with {#anchor} sections
3. Run specgraph
specgraph init # Project overview (great for agent onboarding)
specgraph ls # List all specs with ticket counts
specgraph open # See all open tickets
Configuration
specgraph looks for specgraph.yaml by walking up from your current directory. All paths are relative to the config file.
# specgraph.yaml - full config
# Required
tickets_dir: .tickets # Contains impl/ subdirectory
specs_dir: docs/spec # Markdown specs with {#anchor} sections
# Optional features (comment out to disable)
use_cases_dir: docs/use_cases # Use case tracking
roadmap_file: docs/ROADMAP.md # Milestone tracking
benchmarks_dir: benchmarks # Benchmark management
contacts_dir: docs/contacts # CRM / contact management
decisions_dir: docs/decisions # ADR cross-references
template: .tickets/TEMPLATE.md # Ticket creation template
# Code directories to scan (for audit/orphan analysis)
# Format: "path:pattern1,pattern2"
code_dirs:
- "src:*.py"
- "lib:*.ts,*.tsx"
# Test directories to scan
test_dirs:
- "tests:test_*.py"
- "src:*.test.ts"
# Directories to skip during scanning
skip_dirs:
- node_modules
- __pycache__
- .venv
# Optional: Python file with custom validators for requirement checking
# validators_file: specgraph_validators.py
Validators (Optional)
For use case requirement checking (specgraph uc show), you can provide project-specific validators. Create a Python file that exports a VALIDATORS dict:
# specgraph_validators.py
from pathlib import Path
def check_ops(root: Path, ref: str) -> bool:
"""Check if an operation exists. ref format: 'domain:op_name'"""
domain, op = ref.split(":", 1)
ops_dir = root / "domains" / domain / "operations"
return ops_dir.exists() and len(list(ops_dir.rglob(f"{op}.yaml"))) > 0
VALIDATORS = {
"ops": check_ops,
}
Then reference it in specgraph.yaml:
validators_file: specgraph_validators.py
Each validator receives (project_root: Path, requirement_string: str) and returns bool.
Agent Onboarding
When an AI agent starts working on your project, it can run:
specgraph init
This prints:
- Project name and root
- Reading order (CLAUDE.md, specs, ADRs)
- Ticket summary (open/closed counts)
- Active work areas
- Key commands to get started
Commands
Ticket Management
| Command | Description |
|---|---|
specgraph ls |
List all specs with ticket counts |
specgraph ls <spec> |
List tickets for a specific spec |
specgraph open |
List all open tickets |
specgraph show <spec>/<ticket> |
Show ticket details |
specgraph close <spec>/<ticket> -c path |
Close with code link |
specgraph new <name> |
Create a new ticket from template |
specgraph summary |
Overall completion summary |
specgraph dashboard |
Visual progress dashboard |
Spec Management
| Command | Description |
|---|---|
specgraph scaffold <spec> |
Create tickets from spec sections |
specgraph specs |
List all spec files |
specgraph completeness <spec> |
Section-level coverage check |
specgraph status |
Show status for all specs |
Graph Traversal
| Command | Description |
|---|---|
specgraph trace <path> |
What spec/ticket covers this code? |
specgraph graph <spec> |
Full graph: spec -> tickets -> code |
specgraph graph -r <path> |
Reverse: what specs touch this dir? |
specgraph related <spec> |
Specs that link to/from this spec |
Audit
| Command | Description |
|---|---|
specgraph audit |
Code coverage and orphan analysis |
specgraph orphans |
List orphan code directories |
specgraph match |
Suggest orphan -> ticket matches |
specgraph validate |
Verify all [[type:id]] links resolve |
specgraph gaps |
Specs without tickets |
Use Cases, Roadmap, CRM, Benchmarks
| Command | Description |
|---|---|
specgraph uc ls |
List use cases with completion % |
specgraph roadmap |
Milestone overview |
specgraph crm ls |
Contact list |
specgraph bench ls |
Benchmark status |
Run specgraph help for the full command reference.
Spec Format
Specs are markdown files with {#anchor} section tags:
---
spec: my-feature
---
# My Feature
## Authentication {#auth}
Users must authenticate via OAuth2...
## Data Model {#data-model}
The following tables are required...
The {#anchor} tags are what specgraph uses to create per-section tickets and track completeness.
Link Syntax
specgraph uses [[type:id]] links for cross-referencing:
[[spec:my-feature]]— link to a spec[[spec:my-feature#auth]]— link to a spec section[[adr:0005]]— link to an ADR[[code:src/auth.py]]— link to code[[ticket:my-feature/auth]]— link to a ticket
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specgraph-0.1.0.tar.gz.
File metadata
- Download URL: specgraph-0.1.0.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dd36ecab41236e525dedea7df6e83410b484548c4396ee3fc9d013073943a7b
|
|
| MD5 |
a7c3c42d0bf9c59212044b3535c51cd0
|
|
| BLAKE2b-256 |
7e403330e48e3f1520c3167081f1ddf40101558ebf9888188cc47367e9c864d9
|
Provenance
The following attestation bundles were made for specgraph-0.1.0.tar.gz:
Publisher:
workflow.yaml on nthh/specgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
specgraph-0.1.0.tar.gz -
Subject digest:
8dd36ecab41236e525dedea7df6e83410b484548c4396ee3fc9d013073943a7b - Sigstore transparency entry: 1179197597
- Sigstore integration time:
-
Permalink:
nthh/specgraph@f915c85827a7e9dc90f1cb294d8bb5383dc5ce52 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nthh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@f915c85827a7e9dc90f1cb294d8bb5383dc5ce52 -
Trigger Event:
release
-
Statement type:
File details
Details for the file specgraph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: specgraph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90bc3d29e1956c4698cfbb8518a0fb4c565e5f3ca948eceb287e43a6d82bc4b0
|
|
| MD5 |
2b1ca4ce3556f080bd82558abd68f33d
|
|
| BLAKE2b-256 |
198a9ecd32d5acf5310ff61c8099c81add3dbddc4747e94e049f4125af8dbdcd
|
Provenance
The following attestation bundles were made for specgraph-0.1.0-py3-none-any.whl:
Publisher:
workflow.yaml on nthh/specgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
specgraph-0.1.0-py3-none-any.whl -
Subject digest:
90bc3d29e1956c4698cfbb8518a0fb4c565e5f3ca948eceb287e43a6d82bc4b0 - Sigstore transparency entry: 1179197619
- Sigstore integration time:
-
Permalink:
nthh/specgraph@f915c85827a7e9dc90f1cb294d8bb5383dc5ce52 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nthh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@f915c85827a7e9dc90f1cb294d8bb5383dc5ce52 -
Trigger Event:
release
-
Statement type: