@codified/cli 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,26 +1,15 @@
1
1
  # Codify
2
2
 
3
- **Living context graph for AI-native teams.**
3
+ **Living Context Graph for AI-Native Teams**
4
4
 
5
- Codify mines your project history into a structured graph that captures decisions, features, customer signals, code artifacts, and their relationships. It then gives Claude Code ambient access to that context via MCP, so your AI assistant understands not just what your code does but *why* it was built that way.
5
+ Codify mines your project history into a structured context graph -- decisions, features, customer signals, code artifacts, and their relationships. Claude Code gets ambient access to that context via MCP, so your AI assistant understands not just what your code does but *why* it was built that way.
6
6
 
7
- A built-in Gap Engine proactively detects missing context, stale assumptions, and untested decisions. Gaps get addressed automatically through graph mining and evidence collection.
7
+ A built-in Gap Engine proactively detects missing context, stale assumptions, and untested decisions. An Autonomous Collection service fills those gaps by mining existing data and reaching out to team members. A Metabolism service continuously maintains graph health through freshness decay, semantic dedup, contradiction resolution, and structural evolution.
8
8
 
9
- ## Prerequisites
10
-
11
- - Node.js 22+
12
- - Docker (for PostgreSQL, NATS, Redis)
13
- - `ANTHROPIC_API_KEY` environment variable (for bootstrap, explain, and collect commands)
14
-
15
- ## Install
9
+ ## Quick Start
16
10
 
17
11
  ```bash
18
12
  npm install -g @codified/cli
19
- ```
20
-
21
- ## Quickstart
22
-
23
- ```bash
24
13
  cd your-project
25
14
  codify up
26
15
  ```
@@ -31,80 +20,165 @@ codify up
31
20
  2. **bootstrap** -- Mines your git history with Claude, extracting decisions, features, and relationships into the context graph.
32
21
  3. **start** -- Launches the MCP server on stdio. Claude Code connects automatically.
33
22
 
34
- After this, open Claude Code in your project. It now has full context about your codebase.
23
+ After this, open Claude Code in your project. It now has full context about your codebase -- 23 tools and 4 resources at its disposal.
24
+
25
+ ## What Claude Code Gets
26
+
27
+ Codify auto-installs its MCP server config during `codify init`. Claude Code connects automatically -- no manual configuration required.
28
+
29
+ ### MCP Tools (23)
30
+
31
+ #### Search and Navigate
32
+
33
+ | Tool | Description |
34
+ |------|-------------|
35
+ | `codify_get_context` | Get the full context surrounding a topic -- decisions, signals, gaps, relationships |
36
+ | `codify_search` | Search the graph using natural language (hybrid keyword + semantic) |
37
+ | `codify_traverse` | Walk the graph from any node following typed edges |
38
+ | `codify_get_decision_trail` | Trace the reasoning chain behind a decision |
39
+ | `codify_explain` | Claude-powered narrative synthesis from graph data |
40
+ | `codify_get_context_package` | Get a synthesized context briefing for a topic |
41
+
42
+ #### Gap Engine
43
+
44
+ | Tool | Description |
45
+ |------|-------------|
46
+ | `codify_get_gaps` | List detected context gaps with priority sorting |
47
+ | `codify_resolve_gap` | Mark a gap as resolved with evidence |
48
+
49
+ #### Collection
50
+
51
+ | Tool | Description |
52
+ |------|-------------|
53
+ | `codify_collect` | Mine evidence for open gaps from the existing graph |
54
+ | `codify_get_collection_plans` | View active collection plans and their status |
55
+ | `codify_get_collection_metrics` | Collection pipeline analytics -- response rates, fill time |
56
+
57
+ #### Metabolism and Evolution
58
+
59
+ | Tool | Description |
60
+ |------|-------------|
61
+ | `codify_get_metabolism_audit` | View the metabolism audit trail -- decay, prune, promote events |
62
+ | `codify_get_evolution_proposals` | View pending structural evolution proposals (type splits) |
63
+ | `codify_execute_evolution` | Execute an approved evolution proposal |
64
+
65
+ #### Context and Decision Support
66
+
67
+ | Tool | Description |
68
+ |------|-------------|
69
+ | `codify_decision_context` | Assemble a decision brief -- prior decisions, evidence, contradictions, risks |
70
+ | `codify_add_context` | Add new context nodes to the graph |
71
+ | `codify_status` | Graph health and statistics |
72
+ | `codify_bootstrap` | Trigger a bootstrap from within Claude Code |
73
+ | `codify_get_digest` | Daily context digest -- graph growth, gaps, metabolism activity |
74
+ | `codify_subscribe_events` | Configure proactive context push notification filters |
35
75
 
36
- ## Commands
76
+ #### Branch Management
37
77
 
38
- ### Getting Started
78
+ | Tool | Description |
79
+ |------|-------------|
80
+ | `codify_create_branch` | Create an exploration branch of the graph |
81
+ | `codify_merge_branch` | Merge a branch back into the main graph |
82
+ | `codify_list_branches` | List active graph branches |
83
+
84
+ ### MCP Resources (4)
85
+
86
+ | Resource | Description |
87
+ |----------|-------------|
88
+ | `codify://schema` | The context graph schema -- node types, edge types, relationships |
89
+ | `codify://quickstart` | Quick start guide for using Codify tools |
90
+ | `codify://context/{topic}` | Dynamic context package for any topic (resource template) |
91
+ | `codify://gaps/active` | Current active gap summary -- count, top 5, clusters |
92
+
93
+ ## CLI Commands (30)
94
+
95
+ ### Setup
39
96
 
40
97
  | Command | Description |
41
98
  |---------|-------------|
42
99
  | `codify up` | One-command setup and start (init + bootstrap + start) |
43
- | `codify init` | Set up infrastructure and configure project |
100
+ | `codify init` | Set up Docker services, run migrations, install MCP config |
44
101
  | `codify bootstrap` | Mine git history into the context graph |
45
102
  | `codify start` | Start the MCP server for Claude Code |
103
+ | `codify project` | Manage multiple projects (create, list, switch) |
46
104
 
47
- ### Working with Context
105
+ ### Graph Operations
48
106
 
49
107
  | Command | Description |
50
108
  |---------|-------------|
109
+ | `codify search <query>` | Search the context graph (keyword + semantic) |
51
110
  | `codify explain <question>` | Ask Claude a question about your project |
52
- | `codify search <query>` | Search the context graph by keyword |
111
+ | `codify briefing <topic>` | Get a synthesized context briefing on a topic |
112
+ | `codify decide <question>` | Assemble decision-point context (evidence, gaps, risks) |
53
113
  | `codify add` | Record a decision, signal, or other context |
54
114
  | `codify graph` | Visualize the context graph (Mermaid diagram) |
55
- | `codify status` | Show project health dashboard |
56
115
 
57
- ### Gaps and Quality
116
+ ### Gap Management
58
117
 
59
118
  | Command | Description |
60
119
  |---------|-------------|
120
+ | `codify status` | Show project health dashboard |
61
121
  | `codify gaps` | Show gaps detected by the Gap Engine |
62
- | `codify triage` | Interactively resolve gaps |
122
+ | `codify triage` | Interactively resolve gaps (with [c]ollect) |
63
123
  | `codify collect` | Mine the graph for evidence to fill gaps |
64
- | `codify check <file>` | Check files for related context (CI-ready) |
124
+ | `codify check <file>` | Check files for related context (CI-ready, exit code 1 on critical gaps) |
125
+ | `codify evolve` | Manage structural evolution proposals |
126
+
127
+ ### Connectors
128
+
129
+ | Command | Description |
130
+ |---------|-------------|
131
+ | `codify connect` | Connect external data sources (Slack, GitHub, Linear, Notion, docs) |
132
+ | `codify connectors` | List all connectors with health status |
65
133
 
66
- ### Projects and Maintenance
134
+ ### Analytics
67
135
 
68
136
  | Command | Description |
69
137
  |---------|-------------|
70
- | `codify project create/list/switch` | Manage multiple projects |
138
+ | `codify digest` | Daily context digest -- graph growth, gaps, metabolism |
139
+ | `codify metrics` | Collection pipeline analytics (response rates, fill time) |
140
+
141
+ ### Maintenance
142
+
143
+ | Command | Description |
144
+ |---------|-------------|
145
+ | `codify audit` | Show metabolism audit trail (decay, prune, promote events) |
146
+ | `codify refresh-freshness` | Recalculate freshness scores for all nodes |
71
147
  | `codify timeline` | Show what changed in the graph over time |
72
- | `codify export` | Backup the graph to JSON |
148
+ | `codify cleanup` | Fix legacy data quality issues (gap descriptions, node titles) |
149
+ | `codify export` | Backup the graph to a JSON file |
73
150
  | `codify import` | Restore the graph from a JSON backup |
74
- | `codify watch` | Start continuous ingest polling |
75
- | `codify connect` | Connect external data sources |
151
+ | `codify watch` | Start continuous ingest polling with heartbeat |
152
+ | `codify embed` | Backfill embeddings for semantic search |
76
153
  | `codify reset` | Reset the context graph (drop all data) |
77
154
 
78
155
  Run `codify <command> --help` for detailed options on any command.
79
156
 
80
- ## MCP Integration
157
+ ## Architecture
81
158
 
82
- Codify auto-installs its MCP server config during `codify init`. Claude Code connects automatically -- no manual configuration required.
159
+ Codify uses PostgreSQL as its single storage engine:
83
160
 
84
- The MCP server exposes tools that Claude can call directly:
161
+ - **Apache AGE** for graph traversal (nodes, edges, typed relationships)
162
+ - **pgvector** for semantic search (Voyage AI embeddings, hybrid keyword + vector ranking)
163
+ - **NATS JetStream** for event-driven gap detection, collection, and metabolism
164
+ - **Redis** for caching
85
165
 
86
- - **codify_get_context** -- Retrieve context nodes by type or ID
87
- - **codify_search** -- Search the graph by keyword
88
- - **codify_explain** -- Claude-powered narrative synthesis from graph data
89
- - **codify_get_gaps** -- List detected context gaps
90
- - **codify_resolve_gap** -- Mark a gap as resolved with evidence
91
- - **codify_add_context** -- Add new context nodes to the graph
92
- - **codify_get_decision_trail** -- Trace the reasoning chain behind a decision
93
- - **codify_traverse** -- Walk the graph from any node
94
- - **codify_status** -- Graph health and statistics
95
- - **codify_collect** -- Mine evidence for open gaps
96
- - **codify_get_context_package** -- Get a bundled context snapshot for a topic
166
+ The context graph stores nodes (Decision, Feature, CustomerSignal, CodeArtifact, Gap, Metric, Discussion, Person, Study) and typed edges representing their relationships. Five subsystems run continuously:
97
167
 
98
- ## How It Works
168
+ 1. **Gap Engine** -- 7 proactive scan patterns detect missing context, stale assumptions, weak evidence, contradictions, orphan nodes, cross-functional blind spots, and assumption drift. Gaps auto-resolve when sufficient evidence arrives.
169
+ 2. **Autonomous Collection** -- Mines the existing graph and connected data sources for evidence that addresses detected gaps. Sends Slack DMs to team members for tribal knowledge. Structures collected data into typed graph nodes via Claude.
170
+ 3. **Metabolism** -- Freshness decay, semantic dedup gating, pruning of stale nodes, contradiction resolution, hot layer TTL, and structural evolution (automatic type splitting when embedding clusters diverge).
171
+ 4. **Connector Health** -- Monitors all connected data sources, auto-reconnects with exponential backoff on transient failures, escalates to critical gaps when connectors stay dead.
172
+ 5. **Context Push** -- Subscribes to significant graph events (critical gaps, connector failures, evolution) and pushes MCP notifications to Claude Code in real time.
99
173
 
100
- Codify uses PostgreSQL as its single storage engine:
174
+ TypeScript monorepo with 8 packages, built with pnpm workspaces and esbuild.
101
175
 
102
- - **Apache AGE** for graph traversal (nodes, edges, relationships)
103
- - **pgvector** for semantic search (embedding-based similarity)
104
- - **NATS JetStream** for event-driven gap detection and metabolism
105
- - **Redis** for caching
176
+ ## Requirements
106
177
 
107
- The context graph stores nodes (Decision, Feature, CustomerSignal, CodeArtifact, Gap, etc.) and typed edges representing their relationships. A Metabolism service continuously maintains graph health through freshness decay, contradiction detection, and deduplication.
178
+ - **Node.js 22+**
179
+ - **Docker** (for PostgreSQL 16 + AGE 1.6 + pgvector, NATS 2.11, Redis 7)
180
+ - **ANTHROPIC_API_KEY** environment variable (for bootstrap, explain, briefing, decide, digest, collect)
181
+ - **VOYAGE_API_KEY** environment variable (optional, for semantic search embeddings)
108
182
 
109
183
  ## Links
110
184
 
@@ -0,0 +1,24 @@
1
+ -- 006: Multi-project support
2
+ -- Add project_id to nodes and edges, create projects table
3
+
4
+ -- Projects table
5
+ CREATE TABLE IF NOT EXISTS projects (
6
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
7
+ name TEXT UNIQUE NOT NULL,
8
+ description TEXT,
9
+ created_at TIMESTAMPTZ DEFAULT now(),
10
+ updated_at TIMESTAMPTZ DEFAULT now()
11
+ );
12
+
13
+ -- Insert default project
14
+ INSERT INTO projects (id, name, description)
15
+ VALUES ('00000000-0000-0000-0000-000000000000', 'default', 'Default project')
16
+ ON CONFLICT (id) DO NOTHING;
17
+
18
+ -- Add project_id to nodes
19
+ ALTER TABLE nodes ADD COLUMN IF NOT EXISTS project_id UUID DEFAULT '00000000-0000-0000-0000-000000000000' REFERENCES projects(id);
20
+ CREATE INDEX IF NOT EXISTS idx_nodes_project_id ON nodes (project_id);
21
+
22
+ -- Add project_id to edges
23
+ ALTER TABLE edges ADD COLUMN IF NOT EXISTS project_id UUID DEFAULT '00000000-0000-0000-0000-000000000000' REFERENCES projects(id);
24
+ CREATE INDEX IF NOT EXISTS idx_edges_project_id ON edges (project_id);
@@ -0,0 +1,17 @@
1
+ CREATE TABLE IF NOT EXISTS collection_metrics (
2
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
3
+ computed_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
4
+ period_start TIMESTAMPTZ NOT NULL,
5
+ period_end TIMESTAMPTZ NOT NULL,
6
+ total_plans_created INTEGER NOT NULL DEFAULT 0,
7
+ total_plans_completed INTEGER NOT NULL DEFAULT 0,
8
+ total_plans_failed INTEGER NOT NULL DEFAULT 0,
9
+ avg_time_to_fill_ms BIGINT,
10
+ median_time_to_fill_ms BIGINT,
11
+ response_rate NUMERIC(5,4),
12
+ channel_stats JSONB DEFAULT '{}',
13
+ gap_type_stats JSONB DEFAULT '{}',
14
+ metadata JSONB DEFAULT '{}'
15
+ );
16
+
17
+ CREATE INDEX IF NOT EXISTS idx_collection_metrics_computed ON collection_metrics(computed_at DESC);