跳到正文
DEV Community· Michael Truong·· 55 分鐘前AI 評分54

Savepoints Lite 讓 Agent 工作階段記錄不再依賴個別程式碼庫

We made agent session logging independent of individual repositories

AI 導讀

Michael Truong 將 Savepoints Lite 發佈為 npm 套件,透過共享 Cursor 插件分發 Agent 工作階段記錄流程,毋須逐個程式碼庫加入設定。

正文

I run agents across a lot of repositories. After each session I want a short record of what shipped, what we decided, and what is still open, written while the work is still fresh.

I also want to carry this practice into repositories I don't own. If I'm contributing a fix to an open source project, I shouldn't need to add my personal tooling or agent instructions to their repository.

I already had a way to preserve context from agent work through a project called Savepoints. It uses agent lifecycle hooks to capture and persist learnings beyond the session that produced them.

While the persistence could be shared across repositories, the lifecycle hooks and rules had to be integrated into each repository. That integration also depended on the host, and not every host exposed the same lifecycle boundaries.

Distributing the methodology as portable skills

I built Savepoints Lite to carry the same methodology across repositories without relying on lifecycle hooks. Rather than embedding the methodology in each repository, Savepoints Lite started as a package of portable agent skills, with routing and persistence as separate capabilities.

A router skill decides when to write a record, and a provider skill persists it. The provider I use is Notion, through the host's existing Notion MCP, which lets an agent read and write Notion. If a write fails, the agent continues its primary work.

Initially, using Savepoints Lite still meant installing the package and adding session logging instructions to each repository's AGENTS.md. The methodology was packaged separately, but activation still depended on each repository.

I then moved distribution into a Cursor team marketplace plugin and activation into global Cursor User Rules. My personal persistence configuration stays in a gitignored local file.

I removed the existing session logging instructions from my repositories and continued recording sessions across them through the shared plugin.

A confirmed write was not always a complete record

Using Savepoints Lite across my repositories, I found that around one in eight persisted records were missing required properties such as the repository or the agent name. A successful write confirmed that the record existed, but not that every property had been stored.

To address this, I added a third capability: a validator CLI that checks a persisted record against its schema. The validator identifies missing properties, and the agent can repair the record if it already knows the missing values.

The validator is responsible for checking the record. It is the agent's responsibility to retrieve it from the data store and pass it to the validator.

In practice, some agents skipped the retrieval step and passed in the original write payload instead. Others struggled to invoke the validator correctly. I simplified the validator's input interface and made the instructions more explicit about how to use it.

Instructions for a deterministic tool matter as much as the tool: they have to say not only when to run it, but how.

Both the validator and its subsequent improvements were distributed through the shared plugin, without requiring changes to my repositories.

Composable capabilities

Savepoints Lite provides independently usable capabilities and leaves their orchestration to the consumer. The skills provide guidance without enforcing a particular integration.

consumer orchestration: agent instructions, hooks, or automation
│
├─ record
│  router skill (decides when to record)
│  └─ provider skill (persists to the data store)
│
└─ verify
   validator CLI (checks the persisted record)

My workflow is one way of composing these capabilities. Other consumers can integrate them through their own instructions, hooks or automation.

Hooks were not the problem in themselves. Requiring every repository to adopt one particular integration was.

Takeaway: A portable methodology should be able to evolve without requiring changes to the repositories where it is used.


Implementation: I've published Savepoints Lite as an npm package I use across my projects. It's part of my agent workflow, but the implementation is public if you want to see how the router, provider, and optional validator fit together.

來源:DEV Community · dev.to