SuperAPI AI Directory

context-memory-keeper

Office & productivity

View repository

Updated 10-16 07:25

About this skill

Context Memory Keeper

Global workflow collaboration constraints (long-conversation anti-drift)

  • This skill must not be used as an isolated entry point. When the user requests a complete paper, Word generation, process continuation, or the stage is uncertain, first return to paper-workflow-orchestrator to determine the current S0-S8 stage.
  • Before starting or continuing the formal task of this skill, you must run:
    python .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --skill context-memory-keeper
    
  • If the output is [WORKFLOW FAIL] or the report status != "PASS", stop this skill and backfill the prerequisite stages according to the failed items in paper_output/qa/workflow_guard_report.json ; do not continue from memory.
  • This skill only writes the paper_output/ artifacts within its own contract scope; after completion, you must return to paper-workflow-orchestrator to determine the next step, and use context-memory-keeper to record completed artifacts, blockers, and the next step.
  • In a long conversation, if the context grows long, the stage is uncertain, or the user calls skills separately, first run:
    python .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --status
    
    then read paper_output/qa/workflow_guard_report.json、paper_output/preflight_report.json、paper_output/input_manifest.json、paper_output/results/run_manifest.json and this skill's upstream JSON contract, and continue according to the recommended_skill and next_action in the report.
  • Before continuing the process, you must treat paper_output/context/workflow_memory.json as a long-term breakpoint record; if its current_step、next_step、recommended_skill and workflow_guard.py --status are inconsistent, the guard report shall prevail.
  • After completing this skill's artifact each time, first return to paper-workflow-orchestrator or run workflow_guard.py --status, then update workflow memory:
    python .claude/skills/context-memory-keeper/scripts/update_workflow_memory.py
    
    After updating, read paper_output/context/workflow_memory.json / .md, and confirm that the next step and recommended skill have been recorded.

Execution contract

  • Upstream input: current competition problem constraints, model route, data sources, chart paths, QA conclusions, newly added user preferences, and process breakpoints.
  • Must output: the updated memoryskill.md; when the short-term workbench is too long, archive old task summaries to memory_archive.md。
  • Downstream handoff: other skills read memoryskill.mdbefore starting complex tasks, to avoid forgetting the current model route, data sources, and user requirements.
  • Recommended next step: after completing the memory update, return to the current skill that called it; if the goal is a complete paper, return to paper-workflow-orchestrator to determine subsequent stages.
  • Failure fallback: if the memory file cannot be safely updated, you should clearly preserve the key conclusions in this round's reply, and prompt for later manual backfilling into the memory file.

Description

This Skill maintains a two-layer memory structure, designed to solve the model's context forgetting problem while keeping the context window tidy.

Files Structure

Executable Workflow Memory

  • After workflow_guard.py --status or after a skill handoff, run:
    python .claude/skills/context-memory-keeper/scripts/update_workflow_memory.py
    
  • The script reads paper_output/qa/workflow_guard_report.json plus key workflow artifacts and writes:
    • paper_output/context/workflow_memory.json
    • paper_output/context/workflow_memory.md
  • Long conversations and resumed sessions should read workflow_memory.json before relying on chat history.
  1. memoryskill.md (Active Memory):
    • Long-term guidelines: user preferences, role settings, global constraints (Read-Only mostly).
    • Short-term workbench: current task state, variables, ongoing steps,external literature/data index (Read-Write frequently)。
  2. memory_archive.md (Archive):
    • Historical records, completed task details (Write-Only mostly).

When to Invoke

  • Read: Before starting a complex task each time, or when the context feels unclear, read memoryskill.md。
  • Update:
    • receive new instructions or complete small steps -> update memoryskill.md 's "Short-term workbench".
    • User modifies global rules -> update memoryskill.md 's "Long-term guidelines".
  • Archive (Cleanup):
    • When the "Short-term workbench" content is too long or a phased task ends -> cut the old content to memory_archive.md, and in memoryskill.md retain only the key conclusions.

Compression Policy (Auto-Cleanup)

  • Trigger condition: When memoryskill.md exceeds 100 lines ,mustperform compression.
  • Retention principles:
    1. User Imperatives: Commands, preferences, and red lines strongly requested by the user (High Priority).
    2. Project Skeleton: Project core framework, critical path, and current phase milestones (Medium Priority).
    3. Active Blockers: Issues currently blocking the task (High Priority).
  • Discard/Archive Principles:
    1. Details: Execution details of completed tasks -> move to memory_archive.md。
    2. Logs: Procedural success/failure logs -> move to memory_archive.md or delete directly.
    3. Expired Context: Invalidated temporary variables or no-longer-relevant context -> delete directly.

Usage Tips

  • Keep memoryskill.md lightweight (recommended < 100 lines) so it can be read quickly at any time.
  • Archiving is amanually triggeredaction (the model decides when to cut and paste).