Part of the DEVIN ecosystem
Track: Understand · Nature: product
For: Developers, AI engineers
Interface: CLI / Python library
devin-graph
Unofficial community project. Not affiliated with, endorsed by, or sponsored by Cognition AI. "Devin" is a trademark of Cognition AI.
Linux · Personal Windows · Corporate Windows
Part of the awesome-devin ecosystem: the curated hub for the devin-* tools.
A knowledge graph over Devin sessions: sessions, projects, files and tools become nodes — queryable ("which sessions touched file X?", "which tools does project Y depend on?") and exportable for visualization.
The problem
After dozens of Devin sessions you lose the thread: which sessions touched
that config file, which tools a project relies on, which projects share the
same files. The data exists in sessions.db (tool_call_state records every
call the agent made) but there is no way to query across sessions — only
per-session scrolling in the UI.
Prior art
- Code-knowledge graphs (Sourcegraph, Glean-style indexes) map code, not agent activity; they don't know what your AI sessions touched.
devin-internals-specprovides the schema + typed read-only parsers this tool builds on;devin-historyexports the same store to notes but has no cross-session structure.- You could hand-write SQL — but the
tool_call_jsonpayload format is undocumented and changes; here it's extracted defensively in one place.
What makes it Devin-native
Edges come from ground truth, not prose: file_touched edges are
extracted from tool_call_state payloads (file paths in fs/terminal tool
calls) and anchored to the session's working_directory. That data simply
doesn't exist outside Devin's store — remove Devin and there is no graph to
build. Schema drift is gated by devin-internals-spec's version detector.
Install
Requires Python ≥ 3.10 and pipx or uv. Per-OS setup lives in the platform guides: Linux · Personal Windows · Corporate Windows.
Source-only distribution. This tool is not yet published to PyPI. Install from source:
pipx install git+https://github.com/Icaro0310/devin-graph.git # or uv tool install git+https://github.com/Icaro0310/devin-graph.git
Usage
# build the graph (auto-detects the Devin sessions.db for your OS) — safe to
# re-run: unchanged sessions are skipped
devin-graph build --graph graph.db
# canned queries
devin-graph query file "src/app.py" --graph graph.db
devin-graph query tool "execute" --graph graph.db
devin-graph query project "my-repo" --graph graph.db
devin-graph query shared-files --graph graph.db
devin-graph query projects-graph --graph graph.db --json
# D3-friendly dump: {"meta", "nodes", "edges"}
devin-graph export --format json --graph graph.db --out graph.json
Matching is forgiving (src/app.py finds /repo/alpha/src/app.py);
everything has --json. query shared-files lists every file touched
by two or more distinct projects, with the project and session lists —
exportable as JSON like the other queries. The source DB is opened
mode=ro and never written — tests assert its hash is unchanged.
Works with Devin alone (Devin-only mode)
devin-graph builds graph.db locally from Devin's session stores — the whole
pipeline is offline. Note that the derived database contains the same
sensitive content as the sessions themselves (prompts, paths, commands):
keep it private like the originals.
Platform support
Tested on Windows and Linux (windows-latest + ubuntu-latest in CI).
The CLI session DB is auto-detected: %APPDATA%/devin/cli/sessions.db on
Windows and $XDG_DATA_HOME/devin/cli/sessions.db on Linux (default
~/.local/share/devin/cli/sessions.db). A legacy ~/.config/devin location
is also checked. Pass --sessions-db to override.
commit nodes + produced/referenced edges attribute sessions to git SHAs seen in tool calls (exact when the SHA appears in a git commit/git push call, seen otherwise). devin-graph sql "SELECT ..." runs read-only SQL over graph.db (SELECT/WITH only, query_only pragma).
--vscdb (auto-detected on build) adds GUI coverage: gui_session nodes keyed by the generated session slug, gui_workspace edges to their workspace project, enriched with lastAccessed when a resourceToSpace editor URI links a space to the slug. Best-effort: only the observed windsurfSpace.* keys are read; unknown/malformed keys are skipped. Pass --vscdb none to disable.
devin-graph view --out file.html renders the graph as a self-contained HTML page (embedded JSON + vanilla-JS force layout — zero CDN, works fully offline). --limit caps nodes (highest-degree kept, flagged TRUNCATED in the header).
Limitations
- Schema-gated. Only
sessions.dbschema v15–v17; newer fails loudly (updatedevin-internals-specfirst). - Heuristic path extraction.
tool_call_*_jsonis an unstable, opaque format: paths are collected from path-ish keys plus path-looking tokens in command strings — best-effort, not contractual. A brand-new tool payload shape may yield partial edges. - CLI sessions only (M1). GUI sessions (
acp-messages/*.db) andstate.vscdbare planned for M2. - Not a code index. Nodes are files the agent touched, not repo contents; no symbol/AST knowledge.
- Read-only by design on Devin stores;
graph.dbis the only thing it writes.
Development
pip install -e ".[dev]"
python -m pytest
Fixtures are generated at test time by devin_internals.fixtures (real v17
DDL, synthetic rows) — no binary fixtures are committed. See
docs/SPEC.md for the graph model and
STATUS.md for the roadmap.
When to use this
- You need cross-session questions: which sessions touched file X, which tools project Y depends on, which projects share files.
- You want edges from ground truth — real
tool_call_statepayloads, not heuristics over chat text. - You want a graph export to visualize agent activity
(
devin-graph export --format jsonproduces a D3-ready dump). - You want incremental builds — re-running
devin-graph buildskips unchanged sessions.
When NOT to use this
- You need a code index — nodes are files the agent touched, not repo contents; there is no symbol/AST knowledge.
- You need message-content search (use
devin-search) or activity/context metrics (usedevin-metrics). - You need GUI session data — M1 covers CLI
sessions.dbonly;acp-messagesis planned for M2.
FAQ
What is devin-graph? A local tool that turns Devin's session database
into a knowledge graph: sessions, projects, files, and tools become nodes,
with edges extracted from real tool-call payloads. You query it with
devin-graph query file|tool|project|shared-files and export it as JSON
for visualization.
How is devin-graph different from devin-search? devin-search finds text: ranked full-text hits inside session content. devin-graph finds structure: which sessions touched which files, which tools which projects use, and which projects share files — relationships, not text matches.
Does it write to Devin's databases? No. The source sessions.db is
opened mode=ro and never written — the test suite asserts its hash is
unchanged. The only file devin-graph creates is its own graph.db.
License
MIT — see LICENSE.
Metadata
Release files for devin-graph 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| devin_graph-0.1.0.tar.gz | 34.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| devin_graph-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.8 kB
Release files / devin_graph-0.1.0.tar.gz
| Download URL | devin_graph-0.1.0.tar.gz |
|---|---|
| Size | 34.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da115b7409baf351d0bd5eea1e75faa3b1d1f7ce0cf3ed04f23553caa690a671
|
|
BLAKE2b-256 checksum How to use checksums |
de67683fe4c4a8bddb2fe333486177ad16fe0a6cb6b321ec2d63505f11f63a77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Release files / devin_graph-0.1.0-py3-none-any.whl
| Download URL | devin_graph-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc0f8a13bb27c6ea4243ac5105474ff4ef2c102ba0ec828d016d1e5ea2daf3ce
|
|
BLAKE2b-256 checksum How to use checksums |
b840e82f6462dda1a7f732dffe8e2a36fb796d16b4e3579ba1c0aed656c862f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|