SuperAPI AI Directory

context-memory-keeper

Office & productivity

View repository

Updated 10-16 08:56

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, continuation of the workflow, or is unsure of the stage, first return to paper-workflow-orchestrator to determine the current S0-S8 stage.
  • Before starting or continuing a 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 it reports status != "PASS", stop this skill and, according to paper_output/qa/workflow_guard_report.json , backfill the prerequisite stages for the failed items; do not continue from memory.
  • This skill only writes 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 invokes 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 the upstream JSON contract of this skill, and continue according to the recommended_skill and next_action in the report.
  • Before continuing the workflow, 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 takes precedence.
  • After completing the artifacts of this skill 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 / .mdto 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, new user preferences, and workflow breakpoints.
  • Required 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 invoked 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, clearly preserve the key conclusions in this round's reply, and prompt for subsequent manual backfilling into the memory file.

Description

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

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 status, variables, ongoing steps,external literature/data index (Read-Write frequently)。
  2. memory_archive.md (Archive):
    • History 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 a small step -> update memoryskill.md the "short-term workbench".
    • User modifies global rules -> update memoryskill.md the "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 keep only the key conclusions.

Compression Policy (Auto-Cleanup)

  • Trigger condition: when memoryskill.md exceeds 100 lines ,mustexecute compression.
  • Retention principle:
    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).