Agent skill

Context Memory Keeper

by yushui2022 in yushui2022/MathModel-Skill

Maintains a two-layer persistent memory for a math-modeling paper workflow: long-term rules plus a short-term workbench, with finished tasks archived.

MITAuto-check passedAgent Workflows

SKILL.md written in Chinese; this summary is our English description.

Install Context Memory Keeper

skills CLI
$ npx skills add yushui2022/MathModel-Skill --skill context-memory-keeper -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install yushui2022/MathModel-Skill context-memory-keeper --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/yushui2022/MathModel-Skill.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/trae/.trae/skills/context-memory-keeper .claude/skills/context-memory-keeper && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-memory-keeper
GitHub stars
452
Used in
1 other repo
Token cost
~893 tokens
SKILL.md length
219 words
Files
4 (incl. scripts)
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

Maintains a two-layer persistent memory for a math-modeling paper workflow: long-term rules plus a short-term workbench, with finished tasks archived.

  • Works in 2 steps: memoryskill.md (Active Memory) → memory_archive.md (Archive)
  • Resuming a long paper-writing workflow where context has started to drift
  • SKILL.md covers 全局流程协作约束(长对话防漂移), 执行契约, Description and Files Structure, plus 4 more sections
  • Runs Python scripts from its folder; calls python

What it does

The skill keeps two files. memoryskill.md is the active memory: long-term principles such as user preferences, role settings and global constraints, which are mostly read-only, and a short-term workbench with current task state, variables, steps in progress and an index of external literature and data, which changes often. memory_archive.md receives summaries of old tasks when the workbench grows too long.

It sits inside a larger paper-writing workflow. Before formal work it runs a workflow_guard.py check from the paper-workflow-orchestrator skill and stops if the report is not a pass, rather than continuing from memory. After outputs are completed it runs scripts/update_workflow_memory.py, which reads the guard report and key artifacts and writes workflow_memory.json and workflow_memory.md under paper_output/context. Long or resumed sessions read workflow_memory.json before trusting chat history, and the guard report wins when the two disagree.

Other skills read memoryskill.md before complex tasks so they keep the model route, data sources and your requirements in view. If the memory files cannot be updated safely, the agent keeps the key conclusions in its reply and asks for a manual note later. The skill text is mostly in Chinese.

When your agent uses it

  • Resuming a long paper-writing workflow where context has started to drift
  • Archiving finished tasks so the active memory stays short
  • Recording completed outputs, blockers and next steps after a skill finishes

Example prompts

  • “Update the workflow memory with what we finished and what blocks the next stage.”
  • “Archive the completed data-cleaning tasks out of the active memory.”
  • “Read the active memory before we continue with the model section.”

Requirements

  • Python, for scripts/update_workflow_memory.py
  • The paper-workflow-orchestrator skill and its workflow_guard.py script

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. memoryskill.md (Active Memory)
  2. memory_archive.md (Archive)

What it can do on your machine

Read from SKILL.md and the folder at commit 7712876. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Memory Keeper loads about 893 tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 219 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~893

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from yushui2022/MathModel-Skill at commit 7712876, republished under its MIT licence (© yushui2022). 219 words, ~893 tokens.

Download SKILL.mdSave it as .claude/skills/context-memory-keeper/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
context-memory-keeper
description
Manages persistent memory. Invoke to read active context or archive old tasks. Structure: Long-term Principles (Rules) + Short-term Workbench (Tasks).

Context Memory Keeper

全局流程协作约束(长对话防漂移)

  • 本 skill 不得作为孤立入口。用户要求完整论文、生成 Word、继续流程或不确定阶段时,先回到 paper-workflow-orchestrator 判断当前 S0-S8 阶段。
  • 启动或继续本 skill 的正式任务前,必须运行:
    bash
    python .trae/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --skill context-memory-keeper
  • 如果输出 [WORKFLOW FAIL] 或报告 status != "PASS",停止本 skill,按 paper_output/qa/workflow_guard_report.json 的失败项回补前置阶段,不得凭记忆继续。
  • 本 skill 只写入自己契约范围内的 paper_output/ 产物;完成后必须回到 paper-workflow-orchestrator 判断下一步,并用 context-memory-keeper 记录已完成产物、阻塞项和下一步。
  • 长对话中如果上下文变长、阶段不确定或用户分开调用 skill,先运行:
    bash
    python .trae/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --status
    再读取 paper_output/qa/workflow_guard_report.json、paper_output/preflight_report.json、paper_output/input_manifest.json、paper_output/results/run_manifest.json 和本 skill 的上游 JSON 契约,按报告里的 recommended_skill 与 next_action 继续。
  • 继续流程前,必须把 paper_output/context/workflow_memory.json 视为长期断点记录;若其中的 current_step、next_step、recommended_skill 与 workflow_guard.py --status 不一致,以 guard 报告为准。
  • 每次完成本 skill 的产物后,先回到 paper-workflow-orchestrator 或运行 workflow_guard.py --status,再更新 workflow memory:
    bash
    python .trae/skills/context-memory-keeper/scripts/update_workflow_memory.py
    更新后读取 paper_output/context/workflow_memory.json / .md,确认下一步和推荐 skill 已记录。

执行契约

  • 上游输入:当前赛题约束、模型路线、数据源、图表路径、QA 结论、用户新增偏好和流程断点。
  • 必须输出:更新后的 memoryskill.md;当短期工作台过长时,将旧任务摘要归档到 memory_archive.md。
  • 下游交接:其他 skill 在复杂任务开始前读取 memoryskill.md,避免遗忘当前模型路线、数据来源和用户要求。
  • 推荐下一步:完成记忆更新后回到调用它的当前 skill;若目标是完整论文,回到 paper-workflow-orchestrator 判断后续阶段。
  • 失败回退:若无法安全更新记忆文件,应在本轮回复中明确保留关键结论,并提示后续手动补写到记忆文件。

Description

此 Skill 维护双层记忆结构,旨在解决模型上下文遗忘问题,同时保持上下文窗口的整洁。

Files Structure

Executable Workflow Memory

  • After workflow_guard.py --status or after a skill handoff, run:
    bash
    python .trae/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):
    • 长期准则: 用户偏好、角色设定、全局约束 (Read-Only mostly)。
    • 短期工作台: 当前任务状态、变量、正在进行的步骤、外部文献/数据索引 (Read-Write frequently)。
  2. memory_archive.md (Archive):
    • 历史记录、已完成的任务详情 (Write-Only mostly)。

When to Invoke

  • Read: 每次开始复杂任务前,或感到上下文模糊时,读取 memoryskill.md。
  • Update:
    • 获得新指令或完成小步骤 -> 更新 memoryskill.md 的“短期工作台”。
    • 用户修改全局规则 -> 更新 memoryskill.md 的“长期准则”。
  • Archive (Cleanup):
    • 当“短期工作台”内容过长或阶段性任务结束 -> 将旧内容剪切到 memory_archive.md,并在 memoryskill.md 中仅保留关键结论。

Compression Policy (Auto-Cleanup)

  • 触发条件: 当 memoryskill.md 超过 100 行 时,必须执行压缩。
  • 保留原则:
    1. User Imperatives: 用户强烈要求的命令、偏好、红线(High Priority)。
    2. Project Skeleton: 项目核心框架、关键路径、当前阶段里程碑(Medium Priority)。
    3. Active Blockers: 正在阻碍当前任务的问题(High Priority)。
  • 丢弃/归档原则:
    1. Details: 已完成任务的执行细节 -> 移至 memory_archive.md。
    2. Logs: 过程性的成功/失败日志 -> 移至 memory_archive.md 或直接删除。
    3. Expired Context: 已失效的临时变量或不再相关的上下文 -> 直接删除。

Usage Tips

  • 保持 memoryskill.md 轻量(建议 < 100 行),以便随时快速读取。
  • 归档是手动触发的动作(由模型决定何时剪切粘贴)。

© yushui2022, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts) in packages/trae/.trae/skills/context-memory-keeper of yushui2022/MathModel-Skill.

  • SKILL.md
  • memory_archive.md
  • memoryskill.md
  • scripts/update_workflow_memory.py

Open the folder on GitHubat commit 7712876

Used in 1 other repository

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in yushui2022/MathModel-Skill, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Context Memory Keeper next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Memory Keeper compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Memory Keeper this skillyushui2022/MathModel-Skill4521 repos~893Automated safety check: PassMIT
Coding Agent Session Findercode-yeongyu/oh-my-openagent70k1 repos~2.8kAutomated safety check: PassCustom licence
Beads Task Memorygastownhall/beads28k—~1.2kAutomated safety check: PassMIT
Session History Searchslopus/happy24k—~3.1kAutomated safety check: PassMIT
Memori Long-Term MemoryMemoriLabs/Memori17k—~2kAutomated safety check: NotesCustom licence
Mindmemos CLImindscale-noah/MindMemOS1k1 repos~3.4kAutomated safety check: PassNone

Similar skills

  • Coding Agent Session Finder

    code-yeongyu/oh-my-openagent

    Finds, reads and reconstructs past coding-agent sessions across Codex, Claude, OpenCode, Senpi and many other local agent logs.

    70k GitHub starsUsed in 1 repo~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Beads Task Memory

    gastownhall/beads

    Tracks multi-session work with dependencies in the bd issue tracker so the agent can find ready tasks and recover its context after conversation compaction.

    28k GitHub stars~1.2k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs.

    24k GitHub stars~3.1k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Memori Long-Term Memory

    MemoriLabs/Memori

    Connects Claude Code to Memori Cloud for long-term memory, recalling stored context before substantive replies and saving new context afterward.

    17k GitHub stars~2k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check: notes
  • Mindmemos CLI

    mindscale-noah/MindMemOS

    Give an AI agent persistent, cross-session long-term memory through MindMemOS.

    1k GitHub starsUsed in 1 repo~3.4k tokens
    Agent WorkflowsAuto-check passed
  • Memori MCP Memory Usage

    MemoriLabs/Memori

    Teaches an MCP-connected agent when and how to call Memori's recall, summary, compaction, augmentation, feedback and quota tools to keep context across sessions.

    17k GitHub stars~3.8k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed

More from yushui2022/MathModel-Skill

All 10 skills in this repo
  • Builds a scoring-aligned outline for a mathematical modeling paper and a model selection plan with baseline, improvement and validation experiments.

    452 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Modeling Code and Result Contracts

    yushui2022/MathModel-Skill

    Generates result-evidence contracts, tables and runnable q1 to q3 modeling code scaffolds for a math modeling paper from a model route, a data plan and cleaned data.

    452 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • Formal Modeling Paper Writer

    yushui2022/MathModel-Skill

    Plans, drafts, audits, formats and verifies a formal mathematical-modeling paper from an evidence chain, delivering audited Markdown and a Word file with native equations.

    452 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Paper Micro-Unit Generator

    yushui2022/MathModel-Skill

    Repairs one failing section of a mathematical modeling paper from the repair queue, or builds a legacy or quickstart scaffold when you ask for one by name.

    452 GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Authoritative Data Harvester

    yushui2022/MathModel-Skill

    Finds authoritative public data sources for modeling tasks, prefers official APIs and bulk downloads, and outputs a reproducible fetch and cleaning plan with citations.

    452 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Math Modeling Data Cleaning and Charts

    yushui2022/MathModel-Skill

    Cleans raw or scraped competition data and produces exploratory charts and a figure plan as one stage of a mathematical modeling paper workflow.

    452 GitHub starsUsed in 1 repo~1.7k tokens
    Auto-check passed

Categories

Questions about Context Memory Keeper

What does Context Memory Keeper do?

Maintains a two-layer persistent memory for a math-modeling paper workflow: long-term rules plus a short-term workbench, with finished tasks archived. The skill keeps two files.md is the active memory: long-term principles such as user preferences, role settings and global constraints, which are mostly read-only, and a short-term workbench with current task state, variables, steps in progress and an index of external literature and data, which changes often.

When should I use Context Memory Keeper?

Context Memory Keeper fits situations like: resuming a long paper-writing workflow where context has started to drift; archiving finished tasks so the active memory stays short; recording completed outputs, blockers and next steps after a skill finishes.

How do I install Context Memory Keeper in Claude Code?

Run `npx skills add yushui2022/MathModel-Skill --skill context-memory-keeper -a claude-code`. Or copy the skill folder (packages/trae/.trae/skills/context-memory-keeper in yushui2022/MathModel-Skill) into .claude/skills/context-memory-keeper in your project. Claude Code loads it when a task matches its description.

How do I install Context Memory Keeper in Codex?

Run `npx skills add yushui2022/MathModel-Skill --skill context-memory-keeper -a codex`. Or copy the skill folder (packages/trae/.trae/skills/context-memory-keeper in yushui2022/MathModel-Skill) into .agents/skills/context-memory-keeper in your project. Codex loads it when a task matches its description.

Can I use Context Memory Keeper in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add yushui2022/MathModel-Skill --skill context-memory-keeper -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-memory-keeper, .gemini/skills/context-memory-keeper, .github/skills/context-memory-keeper and .opencode/skills/context-memory-keeper in your project.

What does Context Memory Keeper need to run?

Going by SKILL.md and its folder, Context Memory Keeper needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python, for scripts/update_workflow_memory.py; The paper-workflow-orchestrator skill and its workflow_guard.py script.

Does Context Memory Keeper access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Context Memory Keeper safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Context Memory Keeper use?

Context Memory Keeper is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Memory Keeper use?

About 893 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Memory Keeper?

Skills that share tags, products or a category with Context Memory Keeper: Coding Agent Session Finder (code-yeongyu/oh-my-openagent, 70k stars), Beads Task Memory (gastownhall/beads, 28k stars), Session History Search (slopus/happy, 24k stars) and Memori Long-Term Memory (MemoriLabs/Memori, 17k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Memory Keeper?

yushui2022 (a GitHub user) maintains it in yushui2022/MathModel-Skill, which has 452 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

Source: yushui2022/MathModel-Skill on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.