Skip to content

feat: add pt-snap memory fragmentation skill - #107

Merged
codeasier merged 2 commits into
mainfrom
feat/skill-memory-fragmentation
Aug 24, 2026
Merged

codeasier merged 2 commits into
mainfrom
feat/skill-memory-fragmentation

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

  • Add the shipped pt-snap-memory-fragmentation workflow for read-only allocator-gap, segment-retention, and segment-churn diagnosis.
  • Separate measured evidence from inference, unknowns, confidence, and validation experiments so SnapshotDB limitations are not overstated.
  • Add focused contract tests and update repository agent navigation for the new skill.

🔗 Related Issue

Fixes #105

🧪 Testing

  • Tests added/updated
  • Manual testing completed

Commands run:

  • PYTHONPATH=src pytest (700 passed, 1 xfailed)
  • pytest tests/test_memory_fragmentation_skill.py (5 passed)
  • ruff check AGENTS.md skills/AGENTS.md skills/pt-snap-memory-fragmentation/SKILL.md tests/AGENTS.md tests/test_memory_fragmentation_skill.py
  • black --check tests/test_memory_fragmentation_skill.py

✅ Checklist

  • Code follows project guidelines
  • Documentation updated (if applicable)
  • No new warnings introduced
  • Changes tested locally

Snapshot Runtime Provenance

  • Snapshot provenance evaluation completed when snapshot runtime files change
    Snapshot provenance decision: no-update
    Snapshot provenance no-update reason: This PR changes only agent skill, navigation documentation, and tests; src/pt_snap_cli/snapshot/** is unchanged.

📸 Screenshots (if applicable)

Not applicable.

📋 Additional Notes

The workflow intentionally treats allocator gaps as pressure indicators rather than a definitive fragmentation ratio or OOM root cause.

@codeasier codeasier left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

验收结论(基于 661e958):

已修复项(2/2)

  • 负数合成事件污染峰值:memory_peak/allocator_gap 已默认带 {"start_id":<range_start>}(默认 0),并补充了合成行可赢峰值、不能用于 active_memory_callstack_at_event 的 allocEventId <= event_id 动态归因的说明;护栏已要求“先拒掉负数峰值再归因”。已在 SKILL.md:100-111,307-315 验证。
  • 事件范围未贯穿:峰值、分配曲线、4 类 segment 事件分页与可选 raw-SQL 聚合现均以同一套 <range_start>/<range_end> 约束(start_id/end_id、min_id/max_id、id >= <range_start> AND id <= <range_end>),并在核验清单中固化一致性。已在 SKILL.md:122-210,329-331 验证。

回归检查

  • pytest tests/test_memory_fragmentation_skill.py tests/test_setup_skill.py 7 passed;ruff check 通过;git diff --check 无空白问题;无 src/ 变更,无行为回归。

两条行内线程已回复并处于 resolved 状态(PRRT_kwDOR8IVYc6bmA96/97)。

@codeasier
codeasier force-pushed the feat/skill-memory-fragmentation branch from 661e958 to adba1c6 Compare August 24, 2026 14:41
@codeasier
codeasier merged commit dffd0f3 into main Aug 24, 2026
6 checks passed
@codeasier
codeasier deleted the feat/skill-memory-fragmentation branch August 24, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add a read-only memory fragmentation diagnostic skill

1 participant