Skip to content

Commit 475be16

Browse files
committed
docs: distribution pass — readme, install matrix, comparison, dev guide, demo tape
1 parent f7b4b45 commit 475be16

6 files changed

Lines changed: 192 additions & 10 deletions

File tree

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# COCOA — dev guide
2+
3+
Static system-graph engine. Package manager: `uv` (`uv sync --all-groups`).
4+
5+
- Tests: `uv run pytest` (unit; integration/e2e/docker markers deselected by
6+
default). `-m integration` runs a real cldk analyzer; `-m e2e` runs the Online
7+
Boutique demo (network + analyzers; strict launch gate); `-m docker` builds and
8+
smokes the image.
9+
- Module map: `cocoa/system/` = engine (detect → driver → facts → stitch →
10+
datastore → build → blast → topology → report/htmlmap); `cocoa/cli.py` = typer
11+
CLI; `cocoa/server.py` + `cocoa/tools/` = MCP; `skills//commands/` = plugin
12+
content (validated by `test/test_plugin_assets.py`).
13+
- Provenance discipline is the product: never emit an edge without
14+
`DERIVED-STATIC`/`INFERRED` tagging; skips are recorded, never silent.
15+
- Conventional commits, no trailers. Branch-per-issue `feat/issue-NNN-<slug>`.

README.md

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,72 @@
11
# COCOA — Code Context Agent
22

3-
Precise static system graphs of polyglot, k8s-native codebases — code + RPC
4-
topology + data access — for AI agents. Powered by [CLDK](https://github.com/codellm-devkit/python-sdk).
3+
**Precise static system graphs of polyglot, k8s-native codebases — for AI agents.**
54

6-
Status: v1 under construction. See issue #1 (epic).
5+
Point COCOA at a repo and it derives one queryable graph of the whole system:
6+
per-service call graphs, cross-service RPC edges (stitched from protos, call sites,
7+
and k8s wiring), and datastore access — every edge tagged `DERIVED-STATIC` (real
8+
static analysis, via [CLDK](https://github.com/codellm-devkit/python-sdk)) or
9+
`INFERRED` (labeled fallback). Never guessed.
10+
11+
> **Graphify indexes files. COCOA understands systems.**
12+
> See the head-to-head: [docs/COMPARISON.md](docs/COMPARISON.md)
13+
14+
## The hero query: blast radius
15+
16+
```bash
17+
cocoa blast -p . --target hipstershop.Money.units --kind proto-field
18+
```
19+
20+
…returns exactly which functions in which services break — across languages, across
21+
RPC boundaries, through the database — with call sites and provenance per hop.
22+
On Google's Online Boutique (11 services, 5 languages), the answer costs ~1/25,000th
23+
of the tokens an agent would burn reading every service (estimated; `cocoa demo`
24+
prints the measurement).
725

826
## Quick start
927

1028
```bash
11-
uv run cocoa map -p /path/to/your/polyglot/repo # build .cocoa/ artifacts
12-
uv run cocoa blast -p /path/to/repo --target hipstershop.Money.units --kind proto-field
13-
uv run cocoa serve -p /path/to/repo # MCP server (5 system tools)
14-
uv run cocoa demo # Online Boutique flagship demo
29+
# no install (uv required):
30+
uvx --from git+https://github.com/codellm-devkit/cocoa cocoa map -p /path/to/repo
31+
uvx --from git+https://github.com/codellm-devkit/cocoa cocoa blast -p /path/to/repo \
32+
--target <target> --kind <proto-field|rpc|function|table|redis-key>
33+
34+
# flagship demo (clones Online Boutique, maps it, blasts a proto field):
35+
uvx --from git+https://github.com/codellm-devkit/cocoa cocoa demo
36+
37+
# docker (all analyzers baked in, incl. the unreleased Go analyzer):
38+
docker run --rm -v "$PWD:/work" ghcr.io/codellm-devkit/cocoa map -p /work
1539
```
1640

17-
Requires Docker-less local analyzers today: Java/Python/TypeScript run via CLDK
18-
automatically; Go needs `codeanalyzer-go` on PATH (or pointed to via
19-
`CODEANALYZER_GO_BIN`); C# is recorded as skipped until `codeanalyzer-dotnet` ships.
41+
Agent setups (Claude Code plugin with skills + slash commands + MCP, Codex, Cursor,
42+
plain MCP): [docs/INSTALL.md](docs/INSTALL.md).
43+
44+
## What you get
45+
46+
| Artifact | What it is |
47+
|---|---|
48+
| `.cocoa/system-graph.json` | the full graph — query it forever without re-reading source |
49+
| `.cocoa/system-map.html` | self-contained interactive map, provenance-colored |
50+
| `.cocoa/SYSTEM_REPORT.md` | services, topology, data access, dead-RPC candidates, and **every skipped service with its reason** |
51+
52+
## Language & analyzer status (honest)
53+
54+
| Language | Analyzer | Status |
55+
|---|---|---|
56+
| Java | codeanalyzer-java (via cldk) | works; clean pip installs need the jar workaround ([python-sdk#236](https://github.com/codellm-devkit/python-sdk/issues/236)) — the Docker image includes it |
57+
| Python | codeanalyzer-python (via cldk) | works |
58+
| JS/TS | codeanalyzer-typescript (via cldk) | works |
59+
| Go | codeanalyzer-go | unreleased ([codeanalyzer-go#5](https://github.com/codellm-devkit/codeanalyzer-go/issues/5)); Docker image builds it from source; host installs need `codeanalyzer-go` on PATH or `$CODEANALYZER_GO_BIN` |
60+
| C# | codeanalyzer-dotnet | pending ([codeanalyzer-dotnet#1](https://github.com/codellm-devkit/codeanalyzer-dotnet/issues/1)) — services are recorded as skipped, never silently dropped |
61+
62+
## Skills (the agent discipline layer)
63+
64+
The plugin ships four skills modeled on the
65+
[obra/superpowers](https://github.com/obra/superpowers) paradigm: `using-cocoa`
66+
(answer system questions from the graph, not file reads), `mapping-a-system`,
67+
`blast-radius`, and `grounding-claims` — whose HARD-GATE is the product promise:
68+
*never present an `INFERRED` edge as fact.*
69+
70+
## License
71+
72+
MIT. Built on [CodeLLM-DevKit](https://codellm-devkit.info).

demo.tape

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Output demo.gif
2+
Set FontSize 15
3+
Set Width 1200
4+
Set Height 640
5+
Set Theme "Catppuccin Mocha"
6+
7+
Type "cocoa demo"
8+
Enter
9+
Sleep 90s
10+
Type "cocoa blast -p ~/.cocoa/demo/microservices-demo-v0.10.5 --target hipstershop.Money.units --kind proto-field"
11+
Enter
12+
Sleep 8s
13+
Sleep 4s

docs/COMPARISON.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# COCOA vs. graphify
2+
3+
[graphify](https://github.com/Graphify-Labs/graphify) popularized the "index your
4+
repo into a queryable graph" workflow for AI agents — one-command setup, three
5+
artifacts, token-efficient queries. COCOA adopts that exact UX and changes one
6+
thing: **where the edges come from.**
7+
8+
| | graphify | COCOA |
9+
|---|---|---|
10+
| Unit of understanding | a folder of files | a distributed system |
11+
| Edge derivation | tree-sitter AST + LLM inference | real analyzers (WALA, Jedi, ts-morph, go/types via CLDK) + proto/k8s stitching |
12+
| Edge provenance | `EXTRACTED` / `INFERRED` / `AMBIGUOUS` | `DERIVED-STATIC` / `INFERRED` (labeled fallback only) |
13+
| Cross-language links | inferred by the model | derived: proto stubs ↔ handlers ↔ k8s wiring, with anchor-exclusivity and boundary-matching to prevent false edges |
14+
| Databases | absent | first-class: Redis ops, SQL tables, ORM mappings as graph nodes/edges |
15+
| k8s manifests | more files in the graph | a topology source (raw YAML + `helm template` + `kustomize build`) |
16+
| Impact queries | neighborhood lookups | cross-service blast radius with strongest-path provenance semantics |
17+
| Coverage honesty | n/a | every unanalyzed service recorded with a reason; truncation always labeled |
18+
| Artifacts | `graph.json` / `graph.html` / `GRAPH_REPORT.md` | `system-graph.json` / `system-map.html` / `SYSTEM_REPORT.md` |
19+
| Token efficiency | ~1.7k/query vs ~123k naive (their number) | same persisted-graph mechanism; `cocoa demo` measures ~25,000× on Online Boutique (estimate, printed per run) |
20+
21+
The trade: graphify covers 36 grammars and multi-modal inputs (docs, PDFs, images)
22+
today; COCOA covers the languages with real analyzers (Java/Python/JS/TS shipped,
23+
Go built-from-source in Docker, C# pending) and only code + configs. If you need
24+
breadth-first repo Q&A, graphify is excellent. If an agent is about to *change* a
25+
distributed system and needs to know what breaks — edges that are derived, labeled,
26+
and complete-or-disclosed matter. That's COCOA.

docs/INSTALL.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Installing COCOA
2+
3+
COCOA is one Python package (`cocoa` CLI + MCP server) plus a skillset plugin.
4+
Until the PyPI name is freed (tracked in cocoa-mcp#3), install from git via uv.
5+
6+
## Claude Code (full experience: skills + commands + MCP)
7+
8+
```
9+
/plugin marketplace add codellm-devkit/cocoa
10+
/plugin install cocoa@cocoa
11+
```
12+
13+
This registers the four skills, `/cocoa:map`, `/cocoa:blast`, `/cocoa:demo`, and an
14+
MCP server entry that launches `uvx --from git+https://github.com/codellm-devkit/cocoa
15+
cocoa serve -p .` in your project.
16+
17+
## Codex / Cursor / other SKILL.md-compatible agents
18+
19+
Copy the `skills/` directories into your agent's skills location (e.g.
20+
`~/.codex/skills/` or your Cursor rules directory) — each `SKILL.md` is
21+
self-contained and includes the CLI fallback, so no MCP setup is required.
22+
Install the CLI once: `uv tool install git+https://github.com/codellm-devkit/cocoa`.
23+
24+
## Plain MCP (any MCP client)
25+
26+
```json
27+
{
28+
"mcpServers": {
29+
"cocoa": {
30+
"command": "uvx",
31+
"args": ["--from", "git+https://github.com/codellm-devkit/cocoa",
32+
"cocoa", "serve", "-p", "."]
33+
}
34+
}
35+
}
36+
```
37+
38+
## Docker (all analyzers, zero host toolchains)
39+
40+
```bash
41+
docker run --rm -v "$PWD:/work" ghcr.io/codellm-devkit/cocoa map -p /work
42+
```
43+
44+
Includes the unreleased Go analyzer (built from source) and the Java jar workaround.
45+
Note: first Java analysis downloads a JDK into the project's `.cocoa/cache`
46+
(network required once per project).
47+
48+
## Host toolchain notes
49+
50+
- Java: cldk auto-manages the JDK; clean pip installs currently need the jar
51+
workaround (python-sdk#236) — copy `codeanalyzer-2.4.1.jar` from the
52+
codeanalyzer-java releases into cldk's `analysis/java/codeanalyzer/jar/` dir.
53+
- Go: put `codeanalyzer-go` on PATH or set `$CODEANALYZER_GO_BIN`.
54+
- helm/kubectl: optional; enable static rendering of charts/kustomize wiring.

test/test_plugin_assets.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,24 @@ def test_docker_smoke_builds_and_maps():
132132
capture_output=True, text=True, timeout=1800,
133133
)
134134
assert res.returncode == 0, f"smoke failed:\n{res.stdout}\n{res.stderr}"
135+
136+
137+
def test_readme_carries_the_positioning_and_honest_status():
138+
text = (ROOT / "README.md").read_text()
139+
assert "Graphify indexes files" in text # the pitch
140+
assert "DERIVED-STATIC" in text and "INFERRED" in text
141+
assert "docs/INSTALL.md" in text and "docs/COMPARISON.md" in text
142+
assert "codeanalyzer-go" in text # honest prereq status
143+
144+
145+
def test_install_doc_covers_platforms_and_pypi_caveat():
146+
text = (ROOT / "docs" / "INSTALL.md").read_text()
147+
for platform in ("Claude Code", "Codex", "Cursor", "Docker"):
148+
assert platform in text
149+
assert "uvx --from git+" in text # pre-PyPI install path
150+
151+
152+
def test_comparison_is_provenance_led():
153+
text = (ROOT / "docs" / "COMPARISON.md").read_text()
154+
assert "graphify" in text.lower()
155+
assert "AMBIGUOUS" in text and "DERIVED-STATIC" in text

0 commit comments

Comments
 (0)