Skip to content

Commit 00dcb5f

Browse files
committed
feat: update README and documentation for CLI-first workflow and agent instructions
1 parent 9abbc33 commit 00dcb5f

7 files changed

Lines changed: 91 additions & 87 deletions

File tree

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
# *Contextful*
44

5-
**Context Management + Search Engine for Agentic AI.**
5+
**Local Context Management + Search Engine + Memory for Agentic AI.**
66

7-
Contextful is a runtime contextual layer & local search engine for agents that gives them one fast way to find, compress, cite, and remember project context.
7+
Contextful is a runtime contextual layer and local search engine for agents that gives them one fast way to find, compress, cite, and remember project context.
88

9-
Available as a `cli` + MCP & Skill, it integrates seemlessly with Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, and Zed.
9+
Available as a CLI-first tool with an MCP runtime bridge and generated agent instructions, it integrates seamlessly with Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, and Zed.
1010

1111
<img src="docs/supported.png" alt="Contextful screenshot" width="450px" style="border-radius: 20px;" />
1212

@@ -15,9 +15,9 @@ Instead of making an agent read 40 files every session, Contextful indexes the p
1515

1616
## Why?
1717

18-
Context has always been a bottleneck for agentic AI. Large context window models (eg. 1m tokens) are :
18+
Context has always been a bottleneck for agentic AI. Large context window models (for example, 1M tokens) are:
1919
1. Expensive and require significantly more compute & processing time.
20-
2. Halucinate & loose key information as context window fills up.
20+
2. More likely to lose key information as the context window fills up.
2121
3. Most projects have millions of lines of code, but agents can only fit in limited tokens per context window.
2222

2323
The current solution is to make the agent guess which files to read, then pay the token cost to read them every session. This is slow, expensive, and lossy.
@@ -26,7 +26,7 @@ Apart from this, agents have no way to store or share learnings across sessions.
2626

2727
<img src="docs/context-window.png" alt="Contextful screenshot" width="450px" style="border-radius: 20px;" />
2828

29-
I started developing Contextful to keep context window smaller by enabling efficient knowledge retrieval. We can index the project and return a ranked, cited, token-budgeted context pack, we can:
29+
I started developing Contextful to keep the context window smaller by enabling efficient knowledge retrieval. If we index the project and return a ranked, cited, token-budgeted context pack, we can:
3030
- **100x more efficient token usage:** stop paying tokens to re-read the same files.
3131
- **Fewer tool calls:** one context pack can replace dozens of grep, glob, and read-file calls.
3232
- **No lost context between sessions:** agents can store session learnings in an evidence-backed memory ledger.
@@ -65,15 +65,15 @@ Contextful is an MCP server, local indexer, and small CLI:
6565

6666
- **MCP server:** the agent interface.
6767
- **Local daemon / watcher:** indexing, rebuilds, freshness, and future benchmarks.
68-
- **CLI (`cxf`):** human debugging, reports, memory writes, and local smoke tests.
68+
- **CLI (`cxf`):** human setup, indexing, search, memory writes, and local smoke tests.
6969

7070
MCP is the right interface because tools, resources, and prompts are exactly what MCP standardizes. The agent asks for context; Contextful returns compact evidence.
7171

7272
## Install
7373

7474
```bash
75-
npx @inferensys/contextful index --workspace .
76-
npx @inferensys/contextful query "where is user auth handled" --workspace . --budget 2000
75+
npx @inferensys/contextful init --workspace .
76+
npx @inferensys/contextful search "where is user auth handled" --workspace . --budget 2000
7777
```
7878

7979
Run as an MCP server:
@@ -87,10 +87,10 @@ npx @inferensys/contextful server
8787
The primary binary is `cxf`; `contextful` is also provided as a readable alias.
8888

8989
```bash
90+
cxf init --workspace <path>
9091
cxf index --workspace <path> [--watch]
9192
cxf daemon --workspace <path>
92-
cxf query "<query>" --workspace <path> --budget 2000 --json
93-
cxf report --workspace <path> --format markdown|json|html
93+
cxf search "<query>" --workspace <path> --budget 2000 --json
9494
cxf memory add --workspace <path> --claim <text> --evidence <ref>
9595
cxf server
9696
```
@@ -128,14 +128,17 @@ Codex:
128128
codex mcp add contextful -- npx -y @inferensys/contextful server
129129
```
130130

131-
## Viral Receipts
131+
## CLI-First Agent Flow
132132

133-
Contextful reports should make the value visible:
133+
Use `cxf init` once per workspace. It indexes the project and writes `.contextful/AGENT_INSTRUCTIONS.md`, a compact skill-style guide that tells agents when to call `context_pack`, when to search more narrowly, and when memory writes are allowed.
134134

135-
- "Context pack saved 18 tool calls."
136-
- "100k+ tokens avoided by not re-reading files."
137-
- "2x faster context gathering."
138-
- "3 session learnings reused from the memory ledger."
135+
Use `cxf search` when a human wants to test the same evidence pack an agent will receive:
136+
137+
```bash
138+
cxf search "how does auth load user profiles?" --workspace . --budget 2000
139+
```
140+
141+
The MCP server remains the agent interface. The CLI is for setup, inspection, and repeatable local tests.
139142

140143
## Privacy
141144

docs/index.html

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<title>Contextful | MCP Context Engine for Coding Agents</title>
6+
<title>Contextful | Local Context Management + Search Engine + Memory for Coding Agents</title>
77
<meta
88
name="description"
99
content="Contextful is a local-first MCP context management layer for AI coding agents. It gives Codex, Claude Code, Cursor, Windsurf, Copilot, VS Code, Cline, Roo, Continue, and Zed fast code search, context packs, graph context, and evidence-backed memory."
@@ -14,15 +14,15 @@
1414
/>
1515
<link rel="canonical" href="https://inferensys.github.io/contextful/" />
1616
<meta property="og:type" content="website" />
17-
<meta property="og:title" content="Contextful | MCP Context Engine for Coding Agents" />
17+
<meta property="og:title" content="Contextful | Local Context Management + Search Engine + Memory for Coding Agents" />
1818
<meta
1919
property="og:description"
2020
content="Give AI coding agents one ranked, cited, token-budgeted context pack instead of dozens of repeated file reads."
2121
/>
2222
<meta property="og:url" content="https://inferensys.github.io/contextful/" />
2323
<meta property="og:image" content="https://inferensys.github.io/contextful/cover.svg" />
2424
<meta name="twitter:card" content="summary_large_image" />
25-
<meta name="twitter:title" content="Contextful | MCP Context Engine for Coding Agents" />
25+
<meta name="twitter:title" content="Contextful | Local Context Management + Search Engine + Memory for Coding Agents" />
2626
<meta
2727
name="twitter:description"
2828
content="Local-first MCP code search, graph context, evidence packs, and memory for agentic AI development."
@@ -54,7 +54,10 @@
5454
"BM25 lexical search",
5555
"Typed graph tables for files, symbols, chunks, and edges",
5656
"Token-budgeted context_pack tool",
57-
"Evidence-backed memory ledger"
57+
"Evidence-backed memory ledger",
58+
"Compatible with Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, Zed, and any MCP stdio client",
59+
"Agentic memory",
60+
"Context Management for AI coding agents",
5861
]
5962
}
6063
</script>
@@ -530,10 +533,11 @@
530533
<main id="top">
531534
<section class="hero">
532535
<div class="shell">
533-
<p class="eyebrow">Local-first MCP context management for agentic AI</p>
534-
<h1>Contextful gives coding agents the project context they need at runtime.</h1>
536+
<p class="eyebrow">grep isn't enough</p>
537+
<h1>Give coding agents the context they need, efficiently.</h1>
535538
<p class="lead">
536-
Contextful is a highly efficient context layer for Codex, Claude Code, Cursor, Windsurf, GitHub Copilot,
539+
Contextful is a context layer management harness + search engine + cross-session memory for AI coding agents.
540+
Available for Codex, Claude Code, Cursor, Windsurf, GitHub Copilot,
537541
VS Code, Cline, Roo Code, Continue, Zed, and any MCP-compatible coding tool. It indexes your workspace once,
538542
then returns ranked, cited, token-budgeted evidence packs instead of making agents re-read the same files in
539543
every session.
@@ -660,7 +664,8 @@ <h3>Token-budgeted evidence packs</h3>
660664
<h2>Built as the runtime layer agents actually use</h2>
661665
<p class="section-lead">
662666
Contextful is not a hosted code search product and not a vector-only RAG demo. It is a small local system:
663-
a CLI for humans, an indexer for the workspace, a SQLite state store, and an MCP server for the agent.
667+
a CLI for setup and search, an indexer for the workspace, a SQLite state store, generated agent instructions,
668+
and an MCP server for runtime agent calls.
664669
</p>
665670
<div class="flow" aria-label="Contextful architecture flow">
666671
<div class="step">
@@ -805,10 +810,10 @@ <h3>Explain architecture paths</h3>
805810
</p>
806811
</article>
807812
<article class="tile">
808-
<h3>Write better reports</h3>
813+
<h3>Test retrieval before the agent uses it</h3>
809814
<p>
810-
Export Contextful reports that show indexed files, language coverage, recent packs, stale memory warnings,
811-
and estimated tool calls saved.
815+
Run <code>cxf search</code> locally to inspect the same cited evidence pack the agent will receive through
816+
MCP.
812817
</p>
813818
</article>
814819
<article class="tile">
@@ -893,13 +898,13 @@ <h2>Compatible with MCP-aware coding tools</h2>
893898
<div class="shell">
894899
<h2>Install Contextful</h2>
895900
<p class="section-lead">
896-
The npm package ships the <code>cxf</code> CLI and the MCP server. Start by indexing one workspace, then add
897-
the server to your agent client.
901+
The npm package ships the <code>cxf</code> CLI and the MCP server. Start with <code>init</code>, which indexes
902+
the workspace and writes <code>.contextful/AGENT_INSTRUCTIONS.md</code> for your coding agent.
898903
</p>
899904
<div class="commands">
900-
<pre>npx @inferensys/contextful index --workspace .
901-
npx @inferensys/contextful query "where is auth handled" --workspace . --budget 2000
902-
npx @inferensys/contextful report --workspace . --format markdown</pre>
905+
<pre>npx @inferensys/contextful init --workspace .
906+
npx @inferensys/contextful search "where is auth handled" --workspace . --budget 2000
907+
npx @inferensys/contextful memory add --workspace . --claim "..." --evidence file:src/example.ts:1-20</pre>
903908
<pre>codex mcp add contextful -- \
904909
npx -y @inferensys/contextful server
905910

@@ -947,11 +952,11 @@ <h2>FAQ</h2>
947952
</p>
948953
</details>
949954
<details>
950-
<summary>What makes context_pack different from search?</summary>
955+
<summary>How should agents use Contextful?</summary>
951956
<p>
952-
Search returns hits. <code>context_pack</code> returns a ready-to-use bundle: summary, citations, files,
953-
symbols, graph paths, memory hits, confidence, and token estimate. It is designed to be the agent's first
954-
retrieval call.
957+
Agents should call <code>context_pack</code> before broad file exploration. Humans can run
958+
<code>cxf search</code> to preview the same kind of ready-to-use bundle: summary, citations, files,
959+
symbols, graph paths, memory hits, confidence, and token estimate.
955960
</p>
956961
</details>
957962
<details>

docs/llms.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ CLI: cxf
1111

1212
## What Contextful Does
1313

14-
Contextful indexes one workspace and returns ranked, cited, token-budgeted evidence packs through MCP tools. It helps Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, Zed, and other MCP clients find project context without repeatedly reading raw files.
14+
Contextful indexes one workspace and returns ranked, cited, token-budgeted evidence packs through the CLI and MCP tools. It helps Codex, Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, Cline, Roo Code, Continue, Zed, and other MCP clients find project context without repeatedly reading raw files.
1515

1616
## Key Features
1717

1818
- MCP stdio server for coding agents.
19-
- CLI for indexing, querying, reports, memory writes, and local smoke tests.
19+
- CLI-first workflow for initialization, indexing, search, memory writes, and local smoke tests.
20+
- cxf init writes .contextful/AGENT_INSTRUCTIONS.md with skill-style instructions for coding agents.
2021
- Local SQLite state under .contextful/.
2122
- FTS5 and BM25 lexical search over code, docs, symbols, and memories.
2223
- Typed graph tables for files, chunks, symbols, graph nodes, graph edges, node props, and edge props.
@@ -37,8 +38,8 @@ Contextful indexes one workspace and returns ranked, cited, token-budgeted evide
3738
## Install
3839

3940
```bash
40-
npx @inferensys/contextful index --workspace .
41-
npx @inferensys/contextful query "where is auth handled" --workspace . --budget 2000
41+
npx @inferensys/contextful init --workspace .
42+
npx @inferensys/contextful search "where is auth handled" --workspace . --budget 2000
4243
codex mcp add contextful -- npx -y @inferensys/contextful server
4344
```
4445

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@inferensys/contextful",
33
"version": "0.1.0",
4-
"description": "Highly efficient context management for agentic AI: search, evidence packs, and memory for Claude Code, Codex, Cursor, Windsurf, and Copilot.",
4+
"description": "CLI-first context engine for agentic AI: local code search, evidence packs, MCP runtime context, and memory for Claude Code, Codex, Cursor, Windsurf, and Copilot.",
55
"type": "module",
66
"main": "dist/index.js",
77
"bin": {

src/cli.ts

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import process from "node:process";
44
import { Command } from "commander";
5+
import { initWorkspace, renderInitSummary } from "./init.js";
56
import { indexWorkspace, watchWorkspace } from "./indexer.js";
67
import { writeLesson } from "./memory.js";
7-
import { generateReport, renderEvidencePackMarkdown, renderReport } from "./report.js";
8-
import { createContextPack, searchContext } from "./search.js";
8+
import { renderEvidencePackMarkdown } from "./report.js";
9+
import { createContextPack } from "./search.js";
910
import { runMcpServer } from "./mcp-server.js";
10-
import { type ReportFormat } from "./types.js";
1111

1212
const program = new Command();
1313

@@ -16,6 +16,16 @@ program
1616
.description("Contextful: local-first context search, evidence packs, and memory for coding agents.")
1717
.version("0.1.0");
1818

19+
program
20+
.command("init")
21+
.description("Initialize Contextful for a workspace and write agent instructions.")
22+
.option("--workspace <path>", "Workspace path.", process.cwd())
23+
.option("--json", "Print JSON instead of a human summary.")
24+
.action(async (options: { workspace: string; json?: boolean }) => {
25+
const result = await initWorkspace({ workspace: options.workspace });
26+
process.stdout.write(options.json ? `${JSON.stringify(result, null, 2)}\n` : renderInitSummary(result));
27+
});
28+
1929
program
2030
.command("index")
2131
.description("Index a workspace into .contextful.")
@@ -41,37 +51,8 @@ program
4151
});
4252
});
4353

44-
program
45-
.command("query")
46-
.description("Create an evidence pack for a query.")
47-
.argument("<query>", "Query to answer from indexed context.")
48-
.option("--workspace <path>", "Workspace path.", process.cwd())
49-
.option("--budget <tokens>", "Approximate token budget.", parseInteger, 2000)
50-
.option("--json", "Print JSON instead of Markdown.")
51-
.action(async (query: string, options: { workspace: string; budget: number; json?: boolean }) => {
52-
const pack = await createContextPack({ workspace: options.workspace, query, budget: options.budget });
53-
process.stdout.write(options.json ? `${JSON.stringify(pack, null, 2)}\n` : renderEvidencePackMarkdown(pack));
54-
});
55-
56-
program
57-
.command("search")
58-
.description("Search indexed context without compiling a full evidence pack.")
59-
.argument("<query>", "Search query.")
60-
.option("--workspace <path>", "Workspace path.", process.cwd())
61-
.option("--limit <count>", "Max hits.", parseInteger, 10)
62-
.option("--kind <kind>", "all|code|docs|symbols|memory", "all")
63-
.action(async (query: string, options: { workspace: string; limit: number; kind: "all" | "code" | "docs" | "symbols" | "memory" }) => {
64-
process.stdout.write(`${JSON.stringify(await searchContext({ ...options, query }), null, 2)}\n`);
65-
});
66-
67-
program
68-
.command("report")
69-
.description("Generate a context report.")
70-
.option("--workspace <path>", "Workspace path.", process.cwd())
71-
.option("--format <format>", "markdown|json|html", "markdown")
72-
.action(async (options: { workspace: string; format: ReportFormat }) => {
73-
process.stdout.write(renderReport(await generateReport({ workspace: options.workspace }), parseReportFormat(options.format)));
74-
});
54+
addEvidencePackCommand("search", "Search project context and return a token-budgeted evidence pack.");
55+
addEvidencePackCommand("query", "Alias for search.", true);
7556

7657
const memory = program.command("memory").description("Manage evidence-backed agent memory.");
7758

@@ -117,7 +98,16 @@ function parseInteger(value: string): number {
11798
return parsed;
11899
}
119100

120-
function parseReportFormat(value: string): ReportFormat {
121-
if (value === "markdown" || value === "json" || value === "html") return value;
122-
throw new Error(`Unsupported report format: ${value}`);
101+
function addEvidencePackCommand(name: string, description: string, hidden = false): void {
102+
program
103+
.command(name, hidden ? { hidden: true } : undefined)
104+
.description(description)
105+
.argument("<query>", "Query to answer from indexed context.")
106+
.option("--workspace <path>", "Workspace path.", process.cwd())
107+
.option("--budget <tokens>", "Approximate token budget.", parseInteger, 2000)
108+
.option("--json", "Print JSON instead of Markdown.")
109+
.action(async (query: string, options: { workspace: string; budget: number; json?: boolean }) => {
110+
const pack = await createContextPack({ workspace: options.workspace, query, budget: options.budget });
111+
process.stdout.write(options.json ? `${JSON.stringify(pack, null, 2)}\n` : renderEvidencePackMarkdown(pack));
112+
});
123113
}

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { indexWorkspace, watchWorkspace } from "./indexer.js";
2+
export { initWorkspace, renderInitSummary } from "./init.js";
23
export { createContextPack, searchContext, searchCode, traceGraph, tracePath, impactAnalysis, whyChanged, getIndexStatus, classifyQuery } from "./search.js";
34
export { writeLesson, recallMemory } from "./memory.js";
45
export { generateReport, renderReport } from "./report.js";
@@ -13,3 +14,4 @@ export type {
1314
SearchHit,
1415
SearchIntent
1516
} from "./types.js";
17+
export type { InitResult } from "./init.js";

0 commit comments

Comments
 (0)