PhrourRepograph
A persistent cybersecurity graph of code and infrastructure, with deterministic queries. PhrourRepograph indexes a repository into SQLite once, then answers three questions from the same graph: what does this change reach, which tests cover it, and which security-relevant node sits in the path.
Status: 0.1.0 release candidate. The Python, infrastructure, detection rule and document indexers, the graph store, change impact, test selection, CLI and the dual-era MCP server work. PyPI publication and the MCP registry listing are pending.
At a glance
| Input | A repository tree |
| Output | SQLite graph and deterministic query results |
| Engine | phrour-repograph 0.1.0 |
| License | All rights reserved (Soteria Solutions LLC) |
Getting started
Requires Python 3.11 or later. The project has no runtime dependencies.
# from a checkout (development)
python3 -m pip install -e .
# from PyPI, once 0.1.0 is published
uvx phrour-repograph --help
pipx install phrour-repograph
python3 -m pip install --user phrour-repograph
phrour-repograph --version
phrour-repograph --help
Research question
Can one persistent graph, built from syntax and configuration without executing anything, tell a security reviewer where a code or infrastructure change lands, and do it with answers that stay the same from run to run and from agent to agent?
What works
- Repository indexing into SQLite. The walk skips VCS, virtualenv and build directories, files
larger than 1 MiB, and private key or
.envnames. Unchanged files are skipped by SHA-256. - The Python indexer: modules, classes, functions, test functions, imports, local calls, and
inferred attribute references. Each test node gets a
testsedge to the modules it imports. - The rules indexer: Sigma and YARA files become
rulenodes. A MITRE tag becomes atechniquenode with adetectsedge. A rule body is never compiled or run. - The docs indexer: every Markdown file becomes a
docnode. A link or a path that names a file in the repo becomes adocumentsedge; a link to another.mdfile becomesreferences. - The infrastructure indexer: Dockerfile, compose, Kubernetes YAML and Terraform become
container,image,service,host,network,portanddependencynodes. Environment variable names are recorded; their values are not. - Graph queries:
query,trace,paths,stats,export, and thelensview of security kinds (rule,control,vulnerability,identity,service, plus entrypoint functions). - Change impact:
impactmaps changed files to changed nodes, walks outward up to a depth, and labels every reached node with depth and the key path that reached it. Inferred edges are flagged. - Query recipes:
detectionsnames the rules that detect a technique,tests-fornames the tests that reach a file or symbol, anduncoverednames the modules that no test imports. Each answer comes from stored edges, with the key chain that supports it. - Test selection:
select-testswalks forward from each test node to the changed keys and returns the tests, each with the key chain that justifies it. - SEF 1.0 output:
impact --record FILEwrites one evidence record with the indexed file set hash, findings, evidence and limitations. See../security-evidence-schema. - MCP server: newline-delimited JSON-RPC 2.0 over stdio, negotiating protocol
2024-11-05,2025-03-26or2025-06-18, with five read-only tools. See below. - Workspace indexing:
index --workspaceindexes the root repository and every child git repository as separate names, and never folds a nested repository into its parent. - Measured on 2026-11-28 on the development workstation: 12 repositories, 318 files, 1384 nodes and 2602 edges in 0.28 s.
What does not work yet
- YAML and Terraform are read with a line parser for the documented subset, not a full grammar. A manifest the parser does not recognize is recorded as a file only.
- Call resolution is partial. Cross-module calls are not resolved; attribute access through an
import becomes an inferred
referencesedge at confidence 0.6. Test selection therefore works at module granularity: a test that imports a module selects every changed file and symbol in it. uncoveredis an import-level bound, not line coverage. A test that reaches a module through a fixture, a subprocess orimportlibis not counted.- No runtime data. There is no execution, no taint tracking, no dynamic dispatch and no network map.
- No incremental watch mode. Re-indexing parses every changed file again.
- No remote transport for MCP and no authentication. The server is a local stdio process.
Install and run
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -e . pytest
python3 -m pytest -q
Then, from a repository you want in the graph:
phrour-repograph --db .phrour-repograph/graph.db init
phrour-repograph --db .phrour-repograph/graph.db index .
phrour-repograph --db .phrour-repograph/graph.db index /home/me/work --workspace
phrour-repograph --db .phrour-repograph/graph.db stats --json
phrour-repograph --db .phrour-repograph/graph.db query --kind function --name parse --json
phrour-repograph --db .phrour-repograph/graph.db search "credential rotation" --json
phrour-repograph --db .phrour-repograph/graph.db trace 'module:repo:pkg.auth' --depth 2 --json
phrour-repograph --db .phrour-repograph/graph.db impact . --since HEAD~1 --json
phrour-repograph --db .phrour-repograph/graph.db impact . --files src/auth.py --json --record impact.sef.json
phrour-repograph --db .phrour-repograph/graph.db select-tests . --files src/auth.py --json
phrour-repograph --db .phrour-repograph/graph.db detections T1071.001 --json
phrour-repograph --db .phrour-repograph/graph.db tests-for file:myrepo:src/auth.py --json
phrour-repograph --db .phrour-repograph/graph.db uncovered --limit 20
phrour-repograph --db .phrour-repograph/graph.db lens --json
Every command that prints a result takes --json. Exit codes: 0 success, 1 a finding the
caller asked for (no path found, a security node in the impact, an empty lens), 2 a usage
error. impact indexes the target repository before it analyses; the other commands read the
existing database.
MCP server
phrour-repograph --db PATH mcp or python -m phrour-repograph.mcp --db PATH speaks MCP on stdin and
stdout. Logs never go to stdout. server.json next to this README is the registry listing.
The server is dual-era, per the 2026-07-28 protocol revision:
- Modern clients send every request stateless with
_meta["io.modelcontextprotocol/protocolVersion"].server/discoveranswers first and names the supported versions; a version the server lacks answers-32022with that list. Results carryresultType, list results carryttlMsandcacheScope. - Legacy clients (revision
2025-11-25) may sendinitializefirst, or call the read-only tools directly; plain requests are served statelessly.pingworks only in this era. - Revisions
2024-11-05,2025-03-26and2025-06-18are refused with the supported list.
Methods: server/discover, tools/list, tools/call, plus legacy initialize, ping and
notifications. Unknown methods return -32601.
Tools:
| Tool | Arguments | Answer |
|---|---|---|
query_graph |
kind, name, path, repo, limit |
matching nodes |
get_node |
key |
one node or null |
trace_dependencies |
key, depth, direction |
reached nodes with the edge that reached each |
analyze_change |
root, since, files |
changed nodes, impacted nodes, tests, unknowns |
select_tests |
root, since, files |
tests plus the files a runner needs |
Each tool result is one content[0] item of type text that holds a JSON string, mirrored as
structuredContent. The tools are read-only: they never index, write or execute. Every tool
carries annotations (readOnlyHint true, openWorldHint false).
Client configuration (Claude Desktop, OpenClaw, any stdio client):
{
"mcpServers": {
"phrour-repograph": {
"command": "phrour-repograph",
"args": ["--db", "/path/to/repo/.phrour-repograph/graph.db", "mcp"]
}
}
}
Ontology in one paragraph
Nodes are things: repository, file, module, class, function, test, doc, policy,
service, container, image, host, network, port, rule, technique, dependency,
vulnerability, control, identity, device, firmware. Edges are directed and carry a
provenance of observed or inferred plus a confidence: contains, defines, imports,
calls, references, tests, exposes, depends_on, detects, documents, affects,
owns. The full list with one line each is in docs/ontology.md.
Edge confidence tiers
Every edge carries a provenance and a confidence. The tiers are fixed:
| Tier | Confidence | Meaning | Examples |
|---|---|---|---|
| observed | 1.0 | the relationship is written literally in a source file | import, defines, a Markdown link, FROM ubuntu:22.04, depends_on in Compose |
| heuristic | 0.7 - 0.9 | a parser heuristic or naming convention inferred it | a Terraform reference found by block scan (0.7), "a test file imports a module, so it tests it" (0.8) |
| weak | 0.4 - 0.6 | a text mention or a guess-shaped link; review before trusting | a bare file path named in prose (0.5), COPY --from of a non-stage name (0.6) |
--min-confidence (CLI and MCP) drops edges below the threshold before walking, so a review
prompt built only from observed links is one flag away.
Boundary with ExploitGraph
PhrourRepograph owns the code and infrastructure graph, change impact and test selection. ExploitGraph
owns reachability and exploitability of vulnerabilities. PhrourRepograph may carry a vulnerability
node and an affects edge because the ontology is shared, but it does not decide whether a flaw
is exploitable. If a feature could sit in both, fix the row in ../docs/boundaries.md first.
No LLM in the query path
Every answer comes from a SQL query, a graph walk or git diff. There is no model, no embedding
and no ranking that changes between runs. An agent may read the JSON, but the JSON is the same
for every reader.
Limits
- A clean impact result is not proof of safety. It means the graph saw no path, and the graph is static and partial.
- A file that was not indexed (unsupported language, secret-like name, over 1 MiB) cannot appear in any answer.
- Depth bounds the walk. A dependency beyond the requested depth is invisible.
- Results depend on the git ref you diff against.
Standards and references
- tree-sitter, Incremental parsing for source code.
- SQLite, The embedded database used for the graph store.
- Model Context Protocol, The agent interface exposed by the MCP server.
Part of Phrourios Security
Phrourios Security builds security operations you can prove. This project is part of the Phrourios portfolio. Every result carries evidence, limits and a reproduction command.
License
All rights reserved, Soteria Solutions LLC. See LICENSE. Install, run and
unmodified package redistribution for installation are allowed; anything else needs
written permission. Decided 2026-12-03 (D-063), consistent with the Phrourios core
projects rule of 2026-11-30.
Contact
- Project contact: contact@phrourios.com.
- Security issues: see SECURITY.md, or email security@phrourios.com. Do not open a public issue.
Metadata
Release files for phrour-repograph 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 | Provenance | Actions |
|---|---|---|---|---|
| phrour_repograph-0.1.0.tar.gz | 74.0 kB | With provenance | Details for phrour_repograph-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phrour_repograph-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for phrour_repograph-0.1.0-py3-none-any.whl |
Total release size: 131.9 kB
Release files / phrour_repograph-0.1.0.tar.gz
| Download URL | phrour_repograph-0.1.0.tar.gz |
|---|---|
| Size | 74.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b36446e24a16194de07bdb9532dbe72d0f6f9795b1e828523c3458d9e54acdb2
|
|
BLAKE2b-256 checksum How to use checksums |
44d7b06e9ec21bc3789b548f96a0a55cc9cb6de1814dbe7e1e444fa537dae5dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / phrour_repograph-0.1.0-py3-none-any.whl
| Download URL | phrour_repograph-0.1.0-py3-none-any.whl |
|---|---|
| Size | 57.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f917d2be32c0928ad230d3613b77d5aac77e5213a4ec05230779637d21ff687f
|
|
BLAKE2b-256 checksum How to use checksums |
9395b4ef4644fbf2bd16bd212445365bd07eb40fcadf0c9bf1bfd6b0bbc8480d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for phrour-repograph 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for phrour_repograph-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.