跳到正文
FunCoding

memtrace-cochange

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 coupling, co-change, what changes with this, hidden dependencies, or what else needs to move for source code. Do not use git log, git diff, Grep, or manual file search to correlate changes; Memtrace queries co-change and temporal graph data directly.

Star
516
最近提交
2026年11月30日

plugins/memtrace-skills/skills/memtrace-cochange/SKILL.md

在 GitHub 上查看

Overview

Find files that historically co-change with a target symbol or file path — ranked by co-occurrence frequency across git episodes. Surfaces behavioral coupling the static call graph cannot see.

get_impact answers "who calls this?" (structural). get_cochange_context answers "what files always move when this moves?" (historical, file-level).

They are complementary. A file with no call-graph edges to the target can still be a strong cochange partner if it's always modified alongside it in every commit.

Parameter types: Numbers (limit, window_days, etc.) must be JSON numbers — not strings.

Required parameters

ParameterRequiredDefaultNotes
repo_idyes—
targetyes—Symbol name or file path substring — not symbol
limitno10Max cochanged files returned
window_daysno30Lookback from as_of
as_ofnonowWindow anchor
branchnoany branch
{
  "repo_id": "memdb",
  "target": "execute",
  "limit": 10,
  "window_days": 30
}

Full parameter spec for every Memtrace tool: references/mcp-parameters.md (bundled at the memtrace-skills plugin root).

Output

{
  "cochanged_files": [
    {
      "file_path": "src/order/types.rs",
      "cochange_count": 8,
      "last_cochanged_at": "2026-04-13T10:43:00Z"
    }
  ],
  "target_files": ["src/order/service.rs"]
}

There is no cochanges[] with symbol names — results are file-level.

Steps

1. Identify the target

Use find_symbol if needed. Pass the symbol name or a file_path as target.

2. Call get_cochange_context

See required parameters above.

3. Interpret results

High cochange_count on a file → strong historical coupling. When you modify the target, review those files too — even without direct call-graph edges.

4. Cross-reference with call graph

For symbols in cochanged files, optionally run get_impact(target=...):

Structural couplingHistorical couplingInterpretation
YesYesCore dependency — highest risk
NoYesHidden coupling — history-only
YesNoCalled often but changed independently

Use Cases

  • Before modifying a symbol — get blast awareness beyond what get_impact shows
  • Incident investigation — when get_impact doesn't explain the blast radius, check cochange history
  • Code review — verify that a PR touched all historically-coupled partners
  • Refactoring — discover implicit coupling before extracting a module

Common Mistakes

MistakeReality
Only using get_impact for blast radiusStructural coupling misses behavioral coupling — always pair with cochange
Ignoring cochanged files with no call-graph edgesA rarely-called file with high cochange_count is a strong coupling signal
Using cochange as a dependency mapIt's a change correlation, not a dependency graph — files can cochange without any direct relationship
Passing symbol:Required param is target
Expecting cochanges[] with symbol namesResponse is cochanged_files[] (file paths)
Using limit: 20 as defaultAPI default is 10
Empty results with 0 git episodesRun replay_history during indexing to populate co-change data

相似的 Skill

rea-ci-tests-audit

MOmorluto/rea485k近 7 天新增 9,215 个 star

rea-changelog-update

MOmorluto/rea485k近 7 天新增 9,215 个 star

wizard

MAmattpocock/skills336k近 7 天新增 5,004 个 star

pr

MAmattpocock/skills336k近 7 天新增 5,004 个 star

triage

MAmattpocock/skills336k近 7 天新增 5,004 个 star

精选

git-guardrails-claude-code

阻止危险的 git 命令,避免误推、误删分支。

MAmattpocock/skills336k近 7 天新增 5,004 个 star