Skip to content

Memory: a skill and a ~/.agent/memory script for facts later agents read - #104

Merged
lydakis merged 4 commits into
mainfrom
claude/project-thread-k9p3ok
Oct 10, 2026
Merged

lydakis merged 4 commits into
mainfrom
claude/project-thread-k9p3ok

Conversation

@lydakis

@lydakis lydakis commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Before: agents had no shared place for what they learn, such as decisions, your preferences, and traps. The coordinator suggested AGENTS.md lines for anything lasting. A task's worktree starts at the last commit, so it never saw an uncommitted line.

After: each fact is one small Markdown file that later agents read.

  • Your facts live in ~/.agents/memory.
  • A project's facts live in ~/.agents/memory/projects/NAME. That folder is outside the checkout, so the lead and every task's worktree share one copy whether or not it is committed.
  • Each folder's MEMORY.md is an index generated from the facts and held to 4 KiB, so reading it before work stays cheap.
  • The app ships a memory skill. It tells agents to run memory show first, says what to check before relying on a fact, and what to save.
  • The coordinator now saves lasting findings to memory: to yours with --user when they hold across projects, otherwise to the project's. It keeps AGENTS.md suggestions for rules every agent and collaborator must follow.

This is M1 of the shipping plan. You haven't answered decision #6 yet, so this PR takes the recommended picks:

  • (a) project memory lives outside the repo
  • (b) every agent may save

Pick (c), nightly cleanup, is not in this PR. It comes with the consolidation step.

How:

  • app/src-tauri/src/memory.rs adds agent-app --memory show|save|rm|index|check. The app writes ~/.agent/memory at each start, the same way it writes ~/.agent/trigger.
  • Reading. show prints both indexes with their folders' absolute paths. The native read tool doesn't expand ~, and a task's worktree may not know its project.
  • Format. A fact has front matter: name, description, type (user, feedback, project or reference), source, and verified (today's date when saved). It is at most 4 KiB.
  • Concurrency. A save or removal writes the fact and the index under the folder's lock (File::lock), so two agents saving at once can't leave an index missing one of them.
  • Limits. These are refused and change nothing:
    • a save or rebuild that would push the index past 4 KiB (memory_full)
    • piped text past 4 KiB (fact_too_large)
  • Invalid files. A .md file that isn't a valid fact is named in a memory_invalid error rather than left out of the index silently. rm checks the folder before it deletes anything.
  • Repeats. Saving the same fact again, or removing one that's already gone, returns "duplicate": true.
  • Scope. Without --user or --project NAME, the project comes from the working folder. In a task's worktree, git rev-parse --git-common-dir --show-prefix maps the folder to the same place in the main checkout. From there the script uses the nearest .agents/project.toml.
  • Output. Replies are one JSON value on stdout. Errors are one {"error", "detail"} object on stderr with exit 1, matching API_DESIGN.md and the trigger script.
  • Daemon. No daemon or CLI change.
  • Docs. The app/skills/memory/SKILL.md skill is bundled and linked by the existing skill installer. The release check now also tests for it, and docs/APP.md has a new Memory section.

Performance: nothing runs on a hot path. A save lists at most 1,024 entries in one folder, and runs one git process only when no scope is given. Memory adds nothing to an agent's prompt until it reads the index. Putting the index into instructions at creation is M2.

Declined and deferred review findings are in #108: hand-edited files, hostile input, remote hosts, and unusual git layouts.

Checks:

  • cargo fmt --check and cargo clippy --workspace --all-targets -D warnings are clean.
  • The app's node tests pass (195).
  • cargo test --workspace passes except for two tests:
    • remote::tests::no_ssh_config_changes_what_the_app_forces also fails on main in this Linux container.
    • A daemon timing test failed once under full-suite load and passed 3 times alone. This PR doesn't touch the daemon.

This change has nothing visible to screenshot: it is a script and a skill.

🤖 Generated with Claude Code

Agents had no shared place for what they learn: decisions, the person's
preferences, traps. The coordinator suggested AGENTS.md lines, which a
task's worktree sees only once committed.

Facts are one Markdown file each, with front matter, in ~/.agents/memory
(the person's) and ~/.agents/memory/projects/NAME (a project's, outside
the checkout so the lead and every worktree share one copy). Each folder's
MEMORY.md is generated from the front matter and held to 4 KiB.
~/.agent/memory, written by the app like ~/.agent/trigger, saves, removes,
indexes and checks them under the folder's lock; without a scope it finds
the project from the folder, a task's worktree included. The app ships a
memory skill saying what to read, verify and save, and the coordinator's
role saves lasting findings there. No daemon change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019xtP72bEUJnpaJshaUzKwG
@lydakis lydakis self-assigned this Oct 10, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T05:23:45.307396Z 9a8af60 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1de179d602

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/main.rs Resolved
Comment thread app/skills/memory/SKILL.md Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
…hout changing anything

The skill told agents to read ~/.agents/memory paths with the read tool,
which expands no ~ and cannot find a worktree's project. show prints both
indexes with absolute folders. rm reads the folder before deleting, index
refuses a rebuild past 4 KiB, and stdin past 4 KiB is refused, not cut.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019xtP72bEUJnpaJshaUzKwG
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

lydakis commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

8368637 fixes 4 findings: memory show for reading, rm validating before it deletes, the limit on index, and stdin past the limit. The other 3 are logged in #108. Main is merged in.

Checks:

  • cargo fmt, cargo clippy -D warnings and the node tests (195) pass.
  • cargo test --workspace passes apart from two failures that don't involve this PR's code:
    • remote::tests::no_ssh_config_changes_what_the_app_forces fails on Linux on main too.
    • server::tests::admissions_queued_together_share_one_commit_and_answer_in_order failed once under full-suite load and then passed 3 times alone. It's in the daemon crate, which this PR doesn't touch.

Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c9c020e24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
Comment thread app/agents/coordinator.md Resolved
Comment thread app/src-tauri/src/memory.rs Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a8af60e30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src-tauri/src/memory.rs Resolved
@lydakis
lydakis merged commit ca3d499 into main Oct 10, 2026
1 check passed
@lydakis lydakis mentioned this pull request Oct 11, 2026
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.

2 participants