Try It — Knowledge Graph Quick Start
1. Start Neo4j
Section titled “1. Start Neo4j”docker run -d --name neo4j \ -p 7474:7474 -p 7687:7687 \ -e NEO4J_AUTH=neo4j/codegraph \ neo4j:5Verify it’s running: open http://localhost:7474 in your browser.
2. Set Environment Variables
Section titled “2. Set Environment Variables”export NEO4J_PASSWORD=codegraphexport OPENAI_API_KEY=sk-...3. Initialize Your Workspace
Section titled “3. Initialize Your Workspace”cd /path/to/your/projectiw init4. Run the Extraction Pipeline
Section titled “4. Run the Extraction Pipeline”iw run docs/*.md --track open --provider openai -i -vWhat happens:
- Documents are chunked (~16k chars/chunk)
- OpenAI extracts entity-relationship triples per chunk
- Entities and predicates are canonicalized
- Cross-document entities are deduplicated
The -i flag enables incremental caching — re-runs skip unchanged files.
5. Persist to Neo4j
Section titled “5. Persist to Neo4j”iw persist --latest -v6. Query
Section titled “6. Query”Natural language
Section titled “Natural language”iw query "What are the main components?" -s my-projectiw query "What decisions were made about the database?" -s my-project -vRaw Cypher
Section titled “Raw Cypher”iw query --cypher "MATCH (n:Canon:Entity) RETURN n.name, n.type LIMIT 20"iw query --cypher "MATCH ()-[r:CANON_REL]->() RETURN r.predicate, count(*) ORDER BY count(*) DESC"7. Build RAG Context
Section titled “7. Build RAG Context”# Topic-basediw context "authentication architecture" -s my-project
# Entity-seeded (expand 3 hops from a specific entity)iw context -e "React" --hops 3 -s my-project8. Impact Analysis
Section titled “8. Impact Analysis”iw impact src/auth.ts -s my-projectTraces which entities, decisions, and risks are affected by changing a file.
9. Documentation Health
Section titled “9. Documentation Health”# CARI mode (default — no Neo4j needed)iw intent living
# Full KG mode (requires Neo4j)iw intent living --neo4j -s my-projectDetects stale references, structural drift, and contradictions.
The default CARI mode reads the local SQLite index; add --neo4j for the full knowledge-graph analysis.
- Use
smart-mockprovider for testing without API costs:--provider smart-mock - The
--from-fxflag lets you re-run only canonicalization:--from-fx <run-id> - Output as JSON for programmatic use:
-f json -o results.json - Re-runs are fast:
iw runwith-iskips files whose content hasn’t changed
Programmatic API
Section titled “Programmatic API”import { runPipeline, persistToNeo4j, queryKg } from "@intentweave/cli";
// Run extraction (equivalent to iw run docs/*.md --track open --provider openai)await runPipeline({ paths: ["docs/"], track: "open", provider: "openai", incremental: true,});
// Persist latest run to Neo4j (equivalent to iw persist --latest)await persistToNeo4j({ latest: true, verbose: true });
// Query the knowledge graphconst answer = await queryKg({ question: "What are the main components?", space: "my-project",});console.log(answer.text);Next Steps
Section titled “Next Steps”- CLI Reference — full command documentation
- Architecture Overview — how the pipeline works
- CARI Quick Start — zero-dependency local index