memtrace-api-topology
Map API endpoints, outbound HTTP calls, and cross-repo service topology in indexed source code. Use when the user asks about API endpoints, HTTP routes,…
Build a phased, risk-scored refactoring plan from Memtrace complexity, dead-code, bridge, impact analysis, and Cortex decision-memory constraints. Use when the user wants to refactor source code, reduce complexity, clean technical debt, delete dead code, split large functions,
$ npx -y skills add syncable-dev/memtrace-public --skill memtrace-refactoring-guide --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/memtrace-refactoring-guideContext preview
The summary Claude sees to decide when to auto-load this skill.
Build a phased, risk-scored refactoring plan from Memtrace complexity, dead-code, bridge, impact analysis, and Cortex decision-memory constraints. Use when the user wants to refactor source code, reduce complexity, clean technical debt, delete dead code, split large functions,
name: memtrace-refactoring-guide description: "Build a phased, risk-scored refactoring plan from Memtrace complexity, dead-code, bridge, impact analysis, and Cortex decision-memory constraints. Use when the user wants to refactor source code, reduce complexity, clean technical debt, delete dead code, split large functions, extract modules, reorganize code, or choose refactoring priorities. Do not plan refactors from grep/manual reference search alone; check graph impact and decision rationale/bans/contracts before changing existing code."
Guided refactoring workflow — identifies refactoring candidates using structural analysis, scores them by risk and priority, checks Cortex decision memory for rationale/bans/contracts, and produces a phased refactoring plan. Combines complexity metrics, dead code detection, bridge analysis, temporal evolution, and decision memory to prioritize what to refactor first and how to do it safely.
Run these three tools in parallel to build a candidate list:
**a) Complexity hotspots:** Call `find_most_complex_functions` with `top_n: 20`
**b) Dead code:** Call `find_dead_code` to find unused symbols
**c) Architectural bottlenecks:** Call `find_bridge_symbols` to find chokepoints with too much responsibility
Call `get_evolution` with `from: "90d ago"` and `mode: "compound"`.
Review `top_touched_symbols` and `top_changed_files`:
**Priority matrix:**
| | Low Complexity | High Complexity | |---|---|---| | **Stable (low change freq)** | Leave alone | Monitor; refactor if touched | | **Volatile (high change freq)** | Normal; leave alone | **TOP PRIORITY** — refactor first |
For each top-priority candidate, call `get_impact` with `direction: both`:
Also call `get_symbol_context` to check:
For each top candidate, call `recall_decision("<symbol/subsystem/refactor intent>")`. If you have a numeric `symbol_id`, call `why_is_this_here(symbol_id)` and `governing_contracts(symbol_id)`.
For each refactoring target, call `analyze_relationships`:
Full parameter spec for every Memtrace tool: `references/mcp-parameters.md` (bundled at the memtrace-skills plugin root).
Call `list_communities` and check: does the refactoring target sit at a community boundary?
Synthesize into a phased plan:
**Phase 1 — Quick Wins:**
**Phase 2 — High-Impact Refactors:**
**Phase 3 — Structural Improvements:**
For each item, include: 1. **Target** — function/class name, file, current complexity score 2. **Why** — complexity + volatility + blast radius rationale 3. **How** — specific refactoring approach (extract method, split class, introduce interface) 4. **Decision Memory** — relevant Cortex decisions/bans/contracts, or CannotProve as unknown 5. **Risk** — impact analysis rating + affected processes 6. **Test Plan** — which callers/processes to verify
| Condition | Action | |-----------|--------| | Complex + volatile + high blast radius | Highest priority — but plan carefully; incremental approach | | Complex + stable + low blast radius | Can wait; refactor when you're already touching nearby code | | Dead code with zero callers | Run Cortex provenance/recall first; zero callers is not proof that no decision/contract keeps it | | Bridge symbol with many dependents | Extract interface first, then refactor implementation behind it | | Symbol in cross-repo API | Coordinate with consumers; backward-compatible changes only | | Cortex returns a held ban/contract | Preserve it or ask before overriding it |
A phased plan (Phases 1–3). One worked entry:
| Field | Example | |---|---| | Target | `process_payment` — `src/billing/processor.py`, complexity 38 | | Why | Complex + volatile (14 changes/90d in `top_touched_symbols`) + 23-symbol blast radius | | First move | Extract validation branch to `validate_payment_request`; keep callers untouched | | Risk | High — upstream spans 3 processes incl. `checkout_flow`; incremental migration |
Acceptance criteria:
| Mistake | Reality | |----
Structural memory for AI coding agents. Bi-temporal graph, MCP-native, zero LLM calls. Cursor · Claude Code · Codex · DeepSeek Harness · Hermes · VS Code · Windsurf.
Repo: syncable-dev/memtrace-public
Map API endpoints, outbound HTTP calls, and cross-repo service topology in indexed source code. Use when the user asks about API endpoints, HTTP routes,…
Compute what a planned source-code change will break — blast radius, affected processes, cross-repo callers, temporal stability, and Cortex decision-memory…
Find files that historically co-change with a target symbol or file, ranked by co-occurrence across git episodes. Use when the user asks about historical…
Review GitHub pull requests with Memtrace's local graph-backed review engine. Use when the user asks to review a GitHub pull request, run Memtrace code review,…
Map an indexed source-code repo into a structured overview — scale, communities, central symbols, execution flows, API surface, recent activity. Use when the…
Keep the Memtrace index fresh while editing by watching a repo for live, incremental re-indexing. Use when the user asks to keep Memtrace fresh while editing,…