Contexi
Hacker News Show7/2 23:5869

ctx:本地搜索编码代理历史记录的Rust CLI工具

Show HN: ctx – Search the coding agent history already on your machine

阅读原文 ↗

中文摘要

ctx是一个Rust命令行工具,旨在解决编码代理缺乏长期记忆的问题。它将存储在用户机器上的代理对话记录和日志导入结构化的SQLite数据库,并通过排名文本匹配进行搜索,整个过程完全本地化,无需图数据库或托管记忆服务。开发者通过让代理在开始任务前搜索历史记录,可避免重复错误,例如当测试运行因磁盘空间不足失败时,代理能快速找到先前的工作方案。此外,ctx还能生成简洁的会话记录供分享,并支持利用历史数据递归改进代理驱动的软件开发生命周期。

原文内容

Coding agents don't have long-term memory. But you do have months of full-fidelity agent transcripts stored on your machine. A simple solution that goes a long way: ingest those transcripts and logs into a structured SQLite database, then search them with ranked text match. Everything is fully local and doesn't require anything fancy like a graph database or hosted memory service. This is the idea behind ctx, a Rust CLI that handles the ingestion and searching. We give our agents a skill that tells them to reference past sessions before working in an area. Usually we do this through an "Agent History Research Subagent" whose job is just to prepare a short brief covering any relevant history before the task begins. A real example: sometimes our test suite runs would fail because disk was full on the runner. The correct approach was to run the cleanup runbook, but the root cause of the failure was not clear to the agents, so they would think it was a test regression and go down the wrong rabbit hole debugging. When the agent searched history, it realized this failure had been encountered before and found the right workaround immediately. That got the agent onto the right cleanup path, and later we improved the log output so the same failure would be clearer next time. It's a boring story, but it's real agent productivity. Another nice use case is quickly generating session transcripts for sharing. You can exclude the noisy intermediate messages, so the transcript shows the important parts of the session more cleanly. Try attaching a session transcript to your next PR so your teammate and their agent can review the provenance and prompting behind the change. If you're up for an additional challenge, ask your agent to "exhaustively review all agent history in this repo and find where the SDLC is struggling or isn't agent-native". Using past sessions to recursively improve the agentic SDLC is a loop that we're using a lot today. If you try it out, please let us know what you think! Comments URL: https://news.ycombinator.com/item?id=48763462 Points: 30 # Comments: 9