npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentpostmortem

v0.1.1

Published

Postmortem workflow plugin for OpenCode: failure memory, prevention rules, guardrailed retry

Readme

AgentPostmortem

agentpostmortem adds a complete postmortem loop to OpenCode: capture failures, analyze root causes, create guardrails, and retry with context-aware constraints.

This repository is the standalone plugin distribution (not the OpenCode source tree).

Why this plugin is useful

  • Persist failure history across sessions instead of losing context after one run.
  • Generate deterministic failure analysis and reusable prevention rules.
  • Keep retries bounded and explainable (/retry --explain).
  • Evaluate repeat-failure trends locally (/postmortem-eval) without telemetry.

What this plugin adds

  • postmortem_inspect: view the latest redacted last-run snapshot
  • postmortem_record_failure: persist a durable failure record
  • postmortem_why_failed: deterministic analysis + 1-3 prevention rules
  • postmortem_rules: list/show/enable/disable/edit/rate/import rules
  • postmortem_failures: list/show/forget/delete/prune/purge failures
  • postmortem_retry: generate a retry prompt with relevant guardrails (--explain supported)
  • postmortem_disable_lessons: disable/enable injection for the current session
  • postmortem_config: show/set storage mode (user or repo)
  • postmortem_eval: local-only repeat-failure evaluation metrics

Install

See INSTALL.md for full setup.

Quick start:

  1. Add "agentpostmortem" to your opencode.json plugin array.
  2. Run npx --package agentpostmortem postmortem-init in your project.
  3. Restart OpenCode.

Usage examples

The sections below show realistic command sequences you can run in OpenCode. For the full per-command catalog, see commands.md.

1) Capture and analyze a failure in minutes

/inspect --json --errors
/record-failure --yes --json
/why-failed --latest --json

Use this when a run fails and you want a durable record plus deterministic hypotheses before trying fixes.

2) Build guardrails, then retry with context

/rules --action list --json
/retry --explain
/retry --yes

This sequence helps you review active rules, see why each rule was selected, then execute a guarded retry prompt.

3) Tune behavior during a long debugging session

/disable-lessons --json
/disable-lessons --enable --json
/postmortem-config --action show --json

Use /disable-lessons when you want a temporary clean session, then re-enable guardrail injection when you are ready.

4) Manage failure memory and clean up stale records

/failures --action list --json
/failures --action show --id <failure-id> --json
/forget <failure-id>

You can inspect specific incidents and retire low-value memory entries while preserving the rest of your history.

5) Evaluate if failures are repeating

/postmortem-eval --json --window 20

This reports repeat-failure metrics so you can measure whether new rules are reducing recurrence.

Examples folder

  • examples/minimal/opencode.json - minimal plugin config for a project
  • examples/minimal/README.md - minimal setup walkthrough and file map
  • examples/minimal/commands.md - full flag-by-flag reference for every command
  • examples/minimal/playbooks.md - end-to-end incident response and maintenance workflows
  • examples/minimal/commands/ - per-command deep-dive examples

Repository layout

  • src/ - plugin implementation (TypeScript source)
  • src/templates/ - command and skill templates copied by postmortem-init
  • test/ - test suite
  • scripts/ - init script source
  • examples/ - runnable configuration and command examples
  • dist/ - build output (npm ESM + bundled fallback)

Storage and safety

  • Default storage is user-data scoped by project ID.
  • Optional repo-local storage can be enabled with .opencode/postmortem.json and { "storage": "repo" }.
  • Redaction and caps are applied before persistence and before display/injection.

References

  • Plugins docs: https://opencode.ai/docs/plugins
  • Commands docs: https://opencode.ai/docs/commands
  • Skills docs: https://opencode.ai/docs/skills