agentleFS
Hongyu-yuHongyu-yu/matsci-ai-skills/skills/memory/SKILL.md

memory

Skill19 starsChanged 11 months agoMITView on GitHub

a file-based long-term memory using a single JSONL file, with append-only writes and recent-window search via bash + jq.

66 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use harness-review, dev and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • fockusSkill

    harness-review

    Harness v3 統合レビュースキル。コード・プラン・スコープを多角的にレビュー。以下で起動: レビュー、コードレビュー、プランレビュー、スコープ分析、セキュリティ、品質チェック、harness-review。実装・新機能・バグ修正・セットアップ・リリースには使わない。

    Also in 3 projects that use this

  • MicrosoftSkill

    dev

    Development workflows for the playwright-cli repository. Use when the user asks about rolling dependencies, releasing, or other repo maintenance tasks.

    Also in 3 projects that use this

  • AnthropicSkill

    start

    Set up your bio-research environment and explore available tools. Use when first getting oriented with the plugin, checking which literature, drug-discovery, or visualization MCP servers are connected, or surveying available analysis skills before starting a new project.

    Also in 4 projects that use this

  • MicrosoftSkill

    sync

    Sync the current session branch with its upstream branch, or publish the current session branch to a remote. Use when the user asks to sync a branch, pull latest changes, rebase onto upstream, push current branch, publish branch, or set upstream.

    Also in 3 projects that use this

  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 4 projects that use this

  • DockerSkill

    research

    Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".

    Also in 7 projects that use this

  • +1 more from microsoft

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 57 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill proactively for all user prompt that can benefit from memory across sessions, even if the user does not ask.

    line 8
  2. Distinctive:

    Never rewrite existing lines.

    line 26
  3. Distinctive:

    MUST generate valid JSON with correct escaping.

    line 32
  4. Very specific:

    Use jq to stringify/escape safely, then append: jq -cn --arg ts "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" --arg type "$type" --arg content …

    line 33
  5. Distinctive:

    If tags/meta are not provided, write null or omit fields (choose one consistent approach).

    line 37
  6. Distinctive:

    If results < limit, expand window_lines exponentially (e.g., *4) up to a max (e.g., 1,000,000 lines) then stop.

    line 47
  7. Distinctive:

    Make sure commands are safe with arbitrary user text (proper quoting).

    line 68
  8. Distinctive:

    Ensure the skill returns structured JSON to the agent, not raw text logs.

    line 69

“Common” is measured: kept by at least 6 in 10 of the 57 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Use this skill proactively for all user prompt that can benefit from memory across sessions, even if the user does not ask.

Goal

  • Provide two tools: memory_write and memory_search.
  • Memory is stored in a single append-only JSONL file on disk.
  • Writes must always append one valid JSON object per line (JSONL).
  • Reads should prioritize recent entries by searching from the end via a tail window, and only expand the window if needed.

Storage

  • File path, default MEMORY_FILE=~/.codex/memory.jsonl (create if missing).
  • Each line is one JSON object with at least:
    • ts: ISO8601 timestamp
    • type: string (e.g., "note", "fact", "task", "todo")
    • content: string (raw text)
    • tags: optional array of strings
    • meta: optional object
  • Never rewrite existing lines. Append-only only.

Quick start

memory_write(input)

  • Input: {type, content, tags?, meta?}
  • MUST generate valid JSON with correct escaping; do not hand-build JSON strings.
  • Use jq to stringify/escape safely, then append: jq -cn --arg ts "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" --arg type "$type" --arg content "$content"
    --argjson tags "$tags_json_or_null" --argjson meta "$meta_json_or_null"
    '{ts:$ts,type:$type,content:$content,tags:$tags,meta:$meta}' >> memory.jsonl
  • If tags/meta are not provided, write null or omit fields (choose one consistent approach).

memory_search(query)

  • Input: {q: string, limit: int=20, window_lines: int=50000, mode: "rg"|"jq"|"hybrid"="hybrid"}
  • Default behavior (hybrid):
    1. tail -n window_lines memory.jsonl
    2. rg the query string (treat q as a literal substring by default; optionally support regex if q starts with /.../)
    3. from matches, parse/validate lines with jq (ignore malformed lines)
    4. return the most recent results first (since tail window is recent; preserve original order within window, or reverse if easier)
  • If results < limit, expand window_lines exponentially (e.g., *4) up to a max (e.g., 1,000,000 lines) then stop.
  • Output: {results: [json objects], truncated: bool, used_window_lines: int}

Executable scripts

This skill includes runnable reference implementations for the two interfaces:

  • memory/scripts/memory_write (reads JSON from stdin; appends 1 JSONL line; prints JSON result)
  • memory/scripts/memory_search (reads JSON from stdin; searches recent window; prints JSON result)

Examples:

printf '%s' '{"type":"note","content":"User prefers Python.","tags":["preference"]}' | memory/scripts/memory_write
printf '%s' '{"q":"Python","limit":5}' | memory/scripts/memory_search

CLI requirements

  • Depend on standard unix tools: bash, touch, tail, rg (ripgrep), jq.
  • Provide fallbacks: if rg missing, use grep; if jq missing, fail with a clear error.
  • Make sure commands are safe with arbitrary user text (proper quoting).
  • Ensure the skill returns structured JSON to the agent, not raw text logs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.