Skip to content
Agentmart
Submit a tool

memstate-precompact

Run right before /compact.

Skill by equwal

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/equwal-memstate-precompact

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Run right before /compact. Saves this session's working state to memstate, then prints the /compact instruction line to paste, so the next context window starts from memstate instead of a lossy summary.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/memstate-precompact

What's inside

Skill name
memstate-precompact
Description
Run right before /compact. Saves this session's working state to memstate, then prints the /compact instruction line to paste, so the next context window starts from memstate instead of a lossy summary.
License
MIT
Instructions
46 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Before a compact

A compact replaces this context with a summary. What the next context
window needs and memstate does not hold is lost. Do the two steps below
in order, then stop. Do not start new work after step 2.

## 1. Write the session state to memstate

Target: the session's project (the cwd project, or the pinned project).
Use `memstate_remember` for prose and `memstate_set` for one fact. Write
only what the code and the git history cannot answer.

Write these keypaths. Skip one only when it has nothing new.

| Keypath | Content |
|---|---|
| `task.summary.<YYYY_MM_DD>` | One paragraph: the task as the user stated it, what is done with its evidence (tests run, commits made), what is not done, and the exact next step. |
| `decisions.<topic>` | One keypath per choice made this session, with the reason. |
| `gotchas.<topic>` | One keypath per trap found: what failed, the cause, the fix. |
| `todo` | Unfinished items, the ones the user asked for and the ones you found. |
| `questions` | Open questions for the user, with the context an answer needs. |
| `notes.<topic>` | Facts you had to look up and would need again: how a subsystem works, the command that verified a step, a URL. |

Rules:

- Refer to code by symbol name, never by file and line.
- Update an existing keypath. Do not create a sibling for a new value of
  the same fact. The write response names the superseded version.
- State that holds only on an unmerged branch goes under
  `branches.<branch_slug>.*`.
- Never save a denied prompt. Never save a secret.
- A fact about the user or this machine goes to `scope="user"` only when
  it holds in every repository.
- Do not read anything back. The write response is the receipt.

## 2. Print the compact instructions

Print the line below, filled in, as the last thing in your reply, inside
one fenced block. The user pastes it as the argument of `/compact`. Keep
it under 120 words. Name the keypaths exactly as you wrote them.

```
/compact Focus on: project <id>; task "<one line>"; done so far: <one line>; next step: <one line>; open questions: <list or none>. The session state is in memstate under <keypath list>. In the new context, before any other work, call memstate_get on each of those keypaths. Drop tool output, file contents and reasoning from the summary. Keep only what this line says.
```

From equwal/ai-config, MIT.

More from equwal/ai-config

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 11, 2026 (17 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from equwal

Cite this page

memstate-precompact skill. Agent Mart. https://agentmart.dev/skills/equwal-memstate-precompact (last updated 2026-10-24)