
lastwords
io.github.Arvo-AI由 GitHub 账号 Arvo-AI 发布v0.1.5更新于 Nov 5, 2026
Heap histograms, Go profiles, crash logs and core dumps from Kubernetes pods before they died.
概览
以只读方式通过 MCP 读取 lastwords 采集的 Kubernetes Pod OOM 终止、崩溃、核心转储与内存快照,帮助助手解释 Pod 为何死亡。
- 可以做什么
- 按命名空间、类型或时间范围列出并筛选已保存的采集记录
- 打开单条采集,阅读其用通俗语言写成的经过摘要
- 读取采集中的具体文件,如堆直方图、Go 堆剖析、日志、事件与核心转储
- 查看最接近内存上限的容器监视列表
- 适用场景
- 当 Pod 重启、被 OOMKilled 或崩溃时,希望助手查看在容器死亡前和死亡瞬间采集到的证据,而不是依赖 kubectl logs --previous 或已过期的事件。
- 运行要求
- 需要 Kubernetes 集群(1.25 以上、cgroup v2、containerd 或 CRI-O)并通过 Helm 安装 lastwords DaemonSet,以及以 stdio 方式提供该 MCP 服务器的 lastwords CLI/kubectl 插件。读取采集需要 lastwords 命名空间中 pods/proxy 的 RBAC 权限和 API 令牌 Secret;CLI 其余部分使用你的 kubeconfig。
安装
在 SourceWeft 中
- 打开 控制台中的 lastwords,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
[Artifact Hub] [Release] [License]
lastwords
Memory snapshots before OOM kills, and logs and core dumps from crashes, for Kubernetes.
lastwords runs on every node. When a container gets close to its memory limit, it records what is using the memory. When a container dies, it saves the logs of that instance, the pod's events and any core dump. Everything stays on the node (or in S3), and you can read it with kubectl lastwords or from an AI agent over MCP.
The problem
When you look at a pod that died hours ago, most of the evidence is gone:
- OOMKilled leaves no heap dump. The kernel kills the process with SIGKILL.
-XX:+HeapDumpOnOutOfMemoryErrornever fires, and Go, Node and Python get no warning either. kubectl logs --previousonly keeps one restart. After a few crash-loop restarts, the logs from the first failure are gone.- Events expire after one hour (
--event-ttl, default 1h). - Core dumps go nowhere.
core_patternis set per node, so crashing containers either dump nothing or dump to a path inside a container that is about to be deleted.
None of it can be recovered later. It has to be collected while the container is alive or right after it dies, which is what lastwords does.
What it captures
Every capture comes with a summary.md that says what happened in plain words:
Use it
Install the CLI (it is also a kubectl plugin):
The CLI talks to the agents through the Kubernetes API server, so it needs nothing but your kubeconfig.
Guides
Measured on EKS with the failures in this repo; every command and output is from a real run.
- Get a Java heap histogram before Kubernetes OOMKills the pod
- Why -XX:+HeapDumpOnOutOfMemoryError never writes a file in Kubernetes
- Java pod OOMKilled at 80% of its memory limit
- Get core dumps from crashing Kubernetes pods
- Find what is leaking in a Go pod before it is OOMKilled
Agent eval: setup, grader and every transcript from 24 runs with and without lastwords.
Let your AI agent read it
lastwords ships an MCP server. Claude Code, Codex, Cursor and any MCP client can list and read captures:
Then ask: "the checkout pods restarted overnight, why?" Tools: lastwords_list_captures, lastwords_get_capture, lastwords_read_file, lastwords_watchlist. All read-only.
Get told
With a secret set, every webhook delivery is signed: X-Lastwords-Signature: sha256=<HMAC-SHA256 of "<X-Lastwords-Timestamp>.<raw body>">. Verify it before acting on the event, and reject old timestamps:
Go receivers can use github.com/Arvo-AI/lastwords/webhook.Verify.
Every capture also becomes a Kubernetes Event on the pod (LastWordsOOMKill, LastWordsMemoryPressure, LastWordsCrash, ...), so it shows up in kubectl describe pod and anything that watches events. Prometheus metrics are on :9095/metrics.
Configuration
Common settings (see values.yaml for all):
Pod annotations:
Uninstall
On shutdown the agent puts the node's original core_pattern back (checked on EKS: systemd-coredump again after uninstall). Captures and the core helper binary stay in /var/lib/lastwords on each node, so a reinstall keeps your history, and a node whose agent was killed before it could restore core_pattern still has a working helper to hand cores to. Delete that directory on the nodes to remove everything.
How it works
A DaemonSet runs one small agent per node (a static Go binary; requests 20m CPU and 48 MiB). Measured on EKS (t3.large, Amazon Linux 2023): 8m CPU and 12 MiB on a quiet node, 20m CPU and 15 MiB with 35 containers, about 0.5m CPU per container watched.
- It reads every container's memory accounting from the node's cgroup tree twice a second (
memory.current,memory.stat,memory.events, PSI), computes the working set the way the kubelet does, and keeps a 10-minute timeline. - When a container crosses the threshold, or is climbing fast enough to hit its limit within 15 seconds, it collects evidence while the process is still alive. For the JVM it uses the HotSpot attach protocol (what
jcmduses) from outside the container; nothing is installed in your images. For Go it pulls/debug/pprof/heap. - It watches pods on its node. When a container terminates with an error, it copies the dead instance's log file before the next restart rotates it, and saves the pod's events.
- With core dumps on, it points
kernel.core_patternat a small helper that writes the gzipped core next to the captures, and the agent matches it to the pod. - Captures stay on the node's disk under a size and age budget, optionally upload to S3, and are served to the CLI and MCP server through the API server's pod proxy.
More in docs/how-it-works.md.
Security
lastwords reads other processes' memory accounting, so it needs node-level access. Read docs/security.md before installing it in production. In short:
- Without core dumps the agent is not privileged. It runs with
hostPIDand the capabilitiesSYS_PTRACE,DAC_READ_SEARCH,DAC_OVERRIDE,CHOWN,FOWNER,KILL, plus a read-only root filesystem. - Core dumps need
privilegedto setkernel.core_pattern. They are off by default. - Full heap dumps are off by default because they contain whatever was in memory. The default class histogram contains class names and counts, not data.
- Command lines are redacted for arguments that look like secrets.
- Reading captures needs RBAC on
pods/proxyin the lastwords namespace plus the API token secret. The chart creates alastwords-readerRole.
FAQ
My pod was OOMKilled. How do I find out what used the memory?
If lastwords was running, kubectl lastwords list --kind oomkill shows the kill, and the linked pressure capture shows what was using memory before it. If it wasn't running, nothing can recover that information. Install it so the next kill is captured.
Why didn't HeapDumpOnOutOfMemoryError produce a heap dump?
That flag fires when the JVM itself runs out of heap. A container OOM kill is the kernel sending SIGKILL when the whole process (heap plus metaspace, threads, direct buffers, native memory) hits the cgroup limit. The JVM never gets a chance to run. lastwords takes the histogram before that point.
How do I get core dumps from Kubernetes pods?
helm upgrade lastwords ... --set coreDumps.enabled=true. Cores are stored per capture as core.gz. Debug them with gdb and the same binary from the image.
kubectl logs --previous shows nothing useful. Where are the logs of the first crash?
The kubelet only keeps the last terminated instance. lastwords copies each dead instance's log at the moment it dies (the first 3 crashes of a crash loop per 30 minutes, to bound disk use).
Does it replace Prometheus, Datadog or continuous profiling? No. Continuous profilers show where memory is allocated over time. lastwords takes a snapshot right before the kill without changes to your app, and keeps the logs and events that would otherwise expire.
Does it work on EKS, GKE, AKS, OpenShift? It works on any Kubernetes 1.25+ node with cgroup v2 (cgroup v1 is supported for memory too) and containerd or CRI-O. Core dumps need a node path the kernel can execute the helper from; see docs/platforms.md for per-platform notes.
Aurora
lastwords is built by the team behind Aurora, an open-source AI SRE that investigates incidents. Point notifications.webhookUrl at Aurora, or give Aurora the MCP server, and every OOM kill and crash arrives with its evidence attached.
License
Apache 2.0
来源:README.md,提交 73a7e66
工具
0版本历史
2- v0.1.5最新Nov 5, 2026
- v0.1.4Nov 4, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分