Structural search
Indexer-backed AST patterns (no ast-grep CLI). Via MCP
structural_search or:
curl -s -X POST http://127.0.0.1:7420/v1/query/structural-search \
-H 'content-type: application/json' \
-d '{"language":"python","pattern":"async def $NAME($$$ARGS): $$$BODY","limit":20}'
Pattern table:
MCP_API.md. After matches, join to runtime with get_hot_paths,
get_actual_callers, get_function_runtime_summary.
Adaptive probe windows
-
MCP
enable_targeted_instrumentationwith symbol targets +duration_s(e.g. 30) - Reproduce the workload while the window is active
- Re-query callers / summaries
Agents poll GET /v1/probe-commands and ack; the controller owns budgets
(max 32 targets, 50k events/s).
.NET agent
# Terminal 1 — daemon on the .NET demo
./target/debug/codepulse \
--root examples/dotnet-demo \
--db .codepulse/dotnet.db \
--listen 127.0.0.1:7421
# Terminal 2 — demo
export CODEPULSE_ENDPOINT=http://127.0.0.1:7421
export CODEPULSE_SESSION_ID=dotnet_demo
export CODEPULSE_INCLUDE=DotnetDemo
export CODEPULSE_ROOT="$PWD/examples/dotnet-demo"
cd examples/dotnet-demo && dotnet run --urls http://127.0.0.1:8010
# Terminal 3 — load
./examples/dotnet-demo/scenario.sh
Or ./scripts/e2e-dotnet.sh. In your app: call
CodePulseAgent.Install("Your.Namespace") early; set
CODEPULSE_INCLUDE to match.
Point the daemon at your project
./target/debug/codepulse \
--root /path/to/your/app \
--db .codepulse/myapp.db \
--listen 127.0.0.1:7420
Set CODEPULSE_ROOT to the same root. Reindex:
curl -X POST http://127.0.0.1:7420/v1/reindex
Environment variables
| Variable | Used by | Meaning |
|---|---|---|
CODEPULSE_ENDPOINT |
agents, MCP | Daemon base URL |
CODEPULSE_ROOT |
agents / daemon | Workspace root for paths |
CODEPULSE_SESSION_ID |
agents | Stable session id for queries |
CODEPULSE_INCLUDE |
.NET agent | Namespace prefix to patch |
CODEPULSE_MODE |
agents | baseline / targeted / off |
Troubleshooting
| Symptom | Check |
|---|---|
| Empty hot-paths |
Agent installed before app code; workload hit instrumented functions;
CODEPULSE_ROOT matches --root
|
| MCP tools error | Daemon /health; CODEPULSE_ENDPOINT in MCP env |
| Structural search unsupported | Python or C# under indexed root |
| .NET patched 0 methods | CODEPULSE_INCLUDE matches namespace; call Install |