codepulse

User guide

Agent integration

Configure AI hosts to use codepulse via MCP. Copy the bootstrap prompt into a new agent chat for the current project.

Agent Skill (repo): skills/codepulse/SKILL.md

One-liner

Set up codepulse in this repo: clone detroitpro/codepulse, run the daemon on this workspace root, wire the MCP server, install the Python or .NET agent, then use get_hot_paths / structural_search.

Full bootstrap prompt

Paste into a new agent chat for the current project:

You are setting up codepulse (https://github.com/detroitpro/codepulse) for THIS repository so I can ask runtime questions via MCP.

Do the following:

1. Detect the primary language (Python ≥3.12 preferred for first setup; .NET if this is a C# app).
2. If codepulse is not already available locally, clone https://github.com/detroitpro/codepulse.git to a sensible path (or use an existing clone). Build: `cargo build -p codepulse-daemon`.
3. Start the daemon against THIS workspace root:
   `./target/debug/codepulse --root <THIS_REPO_ROOT> --db <clone>/.codepulse/<name>.db --listen 127.0.0.1:7420`
   Verify: `curl -s http://127.0.0.1:7420/health`
4. Install MCP: in `packages/mcp`, `npm install && npm run build`. Add Cursor MCP config:
   {
     "mcpServers": {
       "codepulse": {
         "command": "node",
         "args": ["<ABS>/packages/mcp/dist/index.js"],
         "env": { "CODEPULSE_ENDPOINT": "http://127.0.0.1:7420" }
       }
     }
   }
5. Install the matching runtime agent:
   - Python: `pip install -e <clone>/agents/python`, call `codepulse_agent.install()` at process start,
     set CODEPULSE_ENDPOINT, CODEPULSE_ROOT=<THIS_REPO_ROOT>, CODEPULSE_SESSION_ID.
   - .NET: reference CodePulse.Agent, call `CodePulseAgent.Install("Your.Namespace")`,
     set CODEPULSE_INCLUDE to that namespace prefix.
6. Tell me how to exercise the app so events appear. Then verify with get_session_overview / get_hot_paths
   (or curl /v1/query/hot-paths). Prefer answers over raw dumps.

Constraints: local-first; never request args/returns/locals; use structural_search for AST patterns
(indexer, not ast-grep CLI). Skill: skills/codepulse/SKILL.md in the codepulse repo.
Docs: docs/guide/GETTING_STARTED.md, docs/MCP_API.md.

Install script snippet

CODEPULSE_HOME="${CODEPULSE_HOME:-$HOME/src/codepulse}"
APP_ROOT="${APP_ROOT:-$PWD}"

if [ ! -d "$CODEPULSE_HOME/.git" ]; then
  git clone https://github.com/detroitpro/codepulse.git "$CODEPULSE_HOME"
fi
cd "$CODEPULSE_HOME"
cargo build -p codepulse-daemon
(cd packages/mcp && npm install && npm run build)

./target/debug/codepulse \
  --root "$APP_ROOT" \
  --db "$CODEPULSE_HOME/.codepulse/app.db" \
  --listen 127.0.0.1:7420

Tool catalog — when to use which

get_session_overview
Orient: sessions, coverage, top hot paths
get_hot_paths
“What ran the most?”
get_actual_callers
Real callers of a symbol (not static graph)
get_function_runtime_summary
Stats for one function
structural_search
Find code by AST pattern (Python/C#)
compare_static_vs_runtime
Declared vs observed for a symbol
enable_targeted_instrumentation
Need deeper edges for a short window
list_uncovered_hot_symbols
Complex static symbols never hit

Suggested workflow

  1. structural_search or name guess → candidate symbols
  2. get_hot_paths / summary → did they run?
  3. get_actual_callers → who called them?
  4. If thin: enable_targeted_instrumentation → reproduce → re-query
  5. Answer with concrete functions; do not paste huge event dumps