Metadata-Version: 2.5
Name: clew-trace
Version: 2.4.0
Summary: Queryable, layered symbol database served to AI agents over MCP: doxygen + tree-sitter call graph, threads, locks, dataflow and requirement edges, plus the clew guard pre-commit gate.
Project-URL: Homepage, https://github.com/tvanfossen/clew
Project-URL: Repository, https://github.com/tvanfossen/clew
Project-URL: Issues, https://github.com/tvanfossen/clew/issues
License-Expression: MIT
License-File: LICENSE
Keywords: call-graph,documentation,doxygen,embedded,mcp,static-analysis,traceability,tree-sitter
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: anyio<5,>=4.0
Requires-Dist: kconfiglib<15,>=14
Requires-Dist: lang-parsing-substrate<0.18,>=0.17.0
Requires-Dist: mcp-types<3,>=2
Requires-Dist: mcp<3,>=2
Requires-Dist: pydantic<3,>=2.0
Requires-Dist: pyyaml<8,>=6.0
Requires-Dist: rich<16,>=13.0
Requires-Dist: tomli<3,>=2; python_version < '3.11'
Requires-Dist: uvicorn<1,>=0.30
Requires-Dist: watchdog<7,>=6
Provides-Extra: dev
Requires-Dist: build<2,>=1.0; extra == 'dev'
Requires-Dist: cyclonedx-bom<10,>=7; extra == 'dev'
Requires-Dist: jsonschema<5,>=4; extra == 'dev'
Requires-Dist: myst-parser<5,>=3; extra == 'dev'
Requires-Dist: pre-commit<5,>=3.6; extra == 'dev'
Requires-Dist: pygments<3,>=2.17; extra == 'dev'
Requires-Dist: pytest-cov<8,>=5; extra == 'dev'
Requires-Dist: pytest<10,>=8.0; extra == 'dev'
Requires-Dist: sphinx<9,>=7.3; extra == 'dev'
Requires-Dist: twine<8,>=5.0; extra == 'dev'
Provides-Extra: wiki
Requires-Dist: coverage<8,>=7.4; extra == 'wiki'
Requires-Dist: myst-parser<5,>=3; extra == 'wiki'
Requires-Dist: pygments<3,>=2.17; extra == 'wiki'
Requires-Dist: sphinx<9,>=7.3; extra == 'wiki'
Description-Content-Type: text/markdown

# clew

[![PyPI](https://img.shields.io/pypi/v/clew-trace)](https://pypi.org/project/clew-trace/)
**[clew's own wiki](https://tvanfossen.github.io/clew/)** — built by clew from this repository on every green `main` ·
**[clew-trace on PyPI](https://pypi.org/project/clew-trace/)**

> *A **clew** is the ball of thread Ariadne gave Theseus to find his way out of the labyrinth —
> the archaic spelling, and the direct ancestor, of the word "clue".*

**A symbol graph of your repository, served to Claude over MCP.** One lookup returns a function's
body with its callers, its callees, the thread it runs on and the locks it takes — instead of a
chain of greps the agent rebuilds every session and loses at every context compaction.

```mermaid
flowchart LR
  repo[your repository] --> index[(clew index)]
  index --> agent([the agent, over MCP:<br/>one call per question])
  index --> wiki([you, in the wiki:<br/>requirements · flows · map])
```

## What you get

- **One call instead of a search chain.** `dossier` answers "who calls this, and what does it
  touch" in a single reply, including relationships grep cannot see: function-pointer callbacks,
  thread entry points, the locks held around a call.
- **Answers that say what they do not know.** An unresolved call, a layer that failed to build,
  or a file clew cannot parse is reported as *unresolved* — never quietly as "none".
- **An index that keeps itself current, and stays quiet otherwise.** While a session is in use,
  a saved file in its own project refreshes that index within a couple of seconds (a file-change
  event, not a poll; a burst of writes is one refresh, run at low CPU and disk priority). Any
  other repository is refreshed when it is queried. After `CLEW_IDLE_SECONDS` (default 600) with
  no tool call, the server does no background work at all, and it exits when the session's
  process is gone. In Claude Code every session shares ONE clew server per machine: each
  session runs only a small relay (`clew-proxy`, about 20 MB), which starts the shared server
  when none is running. A query against a stale index refreshes it before answering, and only edited
  files are re-parsed. Separate git worktrees get separate indexes.
- **A wiki generated from the index.** Requirements and the tests that verify them, sequence
  flows, a system map and a page per function, built as a static site, as Markdown for a GitHub
  or Azure DevOps wiki, or served live by the MCP server ([the wiki](https://github.com/tvanfossen/clew/blob/main/docs/WIKI.md)).
- **What the server serves:** <!-- clew:tools -->three tools — `dossier`, `search` and `index` — plus the `propose_declaration` prompt and the wiki as MCP resources (`clew://wiki/{slug}/llms.txt`, `clew://wiki/{slug}/flow/{name}`)<!-- /clew:tools -->.
- **Measured, not asserted.** Each release is graded against the same agent working without
  clew, and published with the defects that move its numbers:
  [acceptance results](https://github.com/tvanfossen/clew/tree/main/acceptance/runs).

## Quick start

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh   # the plugin launches clew through uv
sudo apt install doxygen       # only for C and C++ (brew install doxygen on macOS)
```

Then, in Claude Code:

```
/plugin marketplace add tvanfossen/clew
/plugin install clew@clew
```

The plugin runs the clew-trace release it was published with, through `uvx`; the first launch
installs it. To register clew without the plugin, see
[Install](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#install).

Ask Claude to index the repository — it calls `index(action='refresh')` — then ask about your
code. Rust repositories also need `cargo +nightly`.

**What the plugin runs, sends and fetches.** An MCP server (`clew-mcp`) that builds and queries a
local SQLite index under `~/.local/state/clew`, and one `PostToolUse` hook (`clew-hook`) that, after
a file read or search, adds a short note naming the index call that would have answered more;
`CLEW_HOOK_DISABLE=1` turns it off. Its first launch fetches the pinned clew-trace release from
PyPI through `uv`; after that, clew itself sends nothing over the network. Building an index
runs the repository's own tooling — doxygen on C/C++, and `cargo` on Rust, which can download the
crate's dependencies — so treat indexing a tree like building it. See
[SECURITY.md](https://github.com/tvanfossen/clew/blob/main/docs/SECURITY.md).

## Language support

<!-- The table below is GENERATED by scripts/sync_metadata.py — do not hand-edit. -->
<!-- clew:support -->
| Language | Symbols | Call graph | Doc comments |
|---|:-:|:-:|:-:|
| [C](https://github.com/tvanfossen/clew/blob/main/docs/languages/C_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [C++](https://github.com/tvanfossen/clew/blob/main/docs/languages/CPP_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [Rust](https://github.com/tvanfossen/clew/blob/main/docs/languages/RUST_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [Python](https://github.com/tvanfossen/clew/blob/main/docs/languages/PYTHON_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [JavaScript](https://github.com/tvanfossen/clew/blob/main/docs/languages/JS_TS_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [TypeScript](https://github.com/tvanfossen/clew/blob/main/docs/languages/JS_TS_INTEGRATION.md) | ✓ | ✓ | ✓ |
| [shell](https://github.com/tvanfossen/clew/blob/main/docs/languages/SCRIPT_INTEGRATION.md) | ✓ | — | ✓ |
| [CMake](https://github.com/tvanfossen/clew/blob/main/docs/languages/SCRIPT_INTEGRATION.md) | ✓ | — | ✓ |
| YAML, JSON, Perl, Make | name only | — | — |
<!-- /clew:support -->

Each language links to what its front end populates and what it cannot. Every cell is
re-measured by a test that builds a fixture in that language.

## Learn more

- [**Overview**](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md) — the depth
  - [The tools](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#the-tools)
    · [What's in the database](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#whats-in-the-database)
    · [Refreshing an index](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#refreshing-an-index)
  - [Install and registration](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#install)
    · [The hook, in full](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#what-the-plugin-installs-including-a-hook)
  - [Build a database](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#build-a-database)
    · [Without an agent](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#without-an-agent)
    · [What semver covers](https://github.com/tvanfossen/clew/blob/main/docs/OVERVIEW.md#what-semver-covers)
- [**Using clew as an agent**](https://github.com/tvanfossen/clew/blob/main/SKILLS.md)
- [**Per-language guides**](https://github.com/tvanfossen/clew/tree/main/docs/languages)
- [**The pre-commit gate**, `clew guard`](https://github.com/tvanfossen/clew/blob/main/docs/GUARD.md)
- [**The hypothesis being tested**](https://github.com/tvanfossen/clew/blob/main/docs/CORE_HYPOTHESIS.md)
  · [**Measured results**](https://github.com/tvanfossen/clew/tree/main/acceptance/runs)
- [**Security**](https://github.com/tvanfossen/clew/blob/main/docs/SECURITY.md) — read before
  indexing code you did not write

MIT licensed.
