Skip to main content
Glama
README.md
<div align="center">

<img src="brand/readme-banner.jpg" alt="WeighIn: Human judgment. Agent momentum." width="100%">

**Your agents ask. You weigh in.**

A decision inbox and decision log for AI coding agents.
Works with Claude Code, Codex, Gemini and Antigravity CLI, Grok, Cursor, and anything else that speaks MCP.

[![ci](https://github.com/joshuaevan/weighin/actions/workflows/ci.yml/badge.svg)](https://github.com/joshuaevan/weighin/actions/workflows/ci.yml)
[![license](https://img.shields.io/badge/license-Apache--2.0-7950F2)](LICENSE)
[![MCP](https://img.shields.io/badge/MCP-Streamable_HTTP-00BCEB)](https://modelcontextprotocol.io)

[Quickstart](#quickstart) · [How it works](#how-it-works) · [Connect your agent](#connect-your-agent) · [Self-host](#self-host) · [API](#api)

</div>

---

Brainstorming with an agent usually means answering a stream of questions in real time, in whatever order it thinks of them. Then the reasoning disappears into a transcript that no future session will read.

WeighIn changes both halves of that:

- **The agent queues its questions** as structured cards (pick one, rank, yes/no, scale, a weighted decision matrix) with its reasoning and a recommendation attached. You answer on your phone when you have a minute, and the agent keeps working in the meantime.
- **Every judgment call lands in one log**, whether it came from a card, from chat, or from the agent deciding on its own. Each entry records who decided (you, the model, or both), how big the decision is, what was rejected, and the trail of steps that led there, with the step that tipped it highlighted.
- **Nothing is lost to compaction.** Agents flush their decisions before context is compacted, a hook saves the raw transcript as a backstop, and a fresh session reloads everything with one short brief.

## Quickstart

```sh
npx weighin serve            # API, MCP, and web app on http://localhost:7744
npx weighin install-skill    # teaches your agents the protocol
claude mcp add --transport http weighin http://localhost:7744/mcp
```

Then, in any session, try: *"Let's plan the offline mode. Queue your questions in WeighIn."*

## How it works

```
 agent ──weighin_ask──▶  ┌─────────────┐  ──push──▶  your phone
                         │   WeighIn   │              │ answer cards
 agent ◀─weighin_answers─│  sessions   │◀─────────────┘
 agent ──weighin_log───▶ │  decisions  │
 new session ◀─brief──── │  captures   │◀── pre-compaction hook
                         └─────────────┘
```

| Thing | Id | What it is |
|---|---|---|
| Session | `S12` | One brainstorm: a title, a project, a context blurb a stranger could follow, and its questions |
| Question | `S12.3` | `choice`, `multi`, `rank`, `yesno`, `scale`, `text`, or `matrix`, with *why*, *what changes*, the agent's recommendation, a size, and a blocking flag |
| Decision | `D47` | What was decided, why, rejected alternatives, a highlighted trail, size, origin, who was involved, and its lineage |
| Capture | `C3` | A transcript excerpt saved right before compaction, mined for decisions the agent didn't log |

### Filing

Everything is filed three ways, and agents fill all of it in themselves:

- **Org > project > collection.** Projects are created on first use and can be renamed, colored, grouped into orgs, or merged in the app. A collection is the effort a decision belongs to inside a project ("Offline mode", "Launch").
- **Category.** One shared two-level list used by every project (Engineering > Data model, Business > Pricing, ...). It holds one primary category, with optional secondary ones weighted below it. When nothing fits, the agent's suggestion is kept under *Other*, and you can turn it into a real category with one tap.

So you can ask for "everything open for OP Solutions", "every pricing call across all projects", or "the whole Generalising effort in loadoc".

**Size** is blast radius: `minor` (trivially reversible), `moderate`, `major`, `critical` (permanent or expensive).
**Origin** is how a decision got in: `asked` (answered on a card), `chat` (decided with you), `auto` (the agent decided alone, unconfirmed until you confirm it), or `compaction`.
**Who** is stored on every record: the human, the model id, the client app, and the agent's session ref.

### Built for agents' context windows

Every tool returns compact text, not JSON. Here's a full brief:

```
# WeighIn brief: wordbowl-app
3 decisions · 3 minor hidden (min=minor to show) · 1 open session

## Decisions (newest first)
- D47 major · Offline store: expo-sqlite · why: ship speed weighted 2x · not: WatermelonDB [Josh+claude-opus-5-5 2026-11-27]
- D45 moderate · Conflict rule: host phone wins [Josh+gpt-5.5 2026-11-26]
- D44 moderate · Retry policy: exponential 2s-60s [claude-opus-5-5 2026-11-26 auto,unconfirmed]

## Waiting on the human
- S12 "Onboarding flow" (wordbowl-app) 3/7 answered, 1 blocking open https://decisions.example.dev/s/12
```

All five MCP tools together cost about 2,600 tokens of schema. There's a test that keeps it that way.

## Connect your agent

WeighIn uses the standards every major agent already supports:

- **MCP** (Streamable HTTP at `/mcp`, or `weighin mcp` over stdio) for the tools
- **Agent Skills** (`skills/weighin/SKILL.md`) for the protocol: when to queue vs. ask, how to write a good question, when to log, how to size a decision
- **OpenAPI** (`/openapi.json`) and **`llms.txt`** for anything else, including plain `curl`
- **Hooks** where the client has them, for compaction

Per-client setup is in [`integrations/`](integrations/).

### Commands

The skill teaches every agent the same commands:

| Say | What happens |
|---|---|
| `/weighin save` | Log every unlogged decision from this conversation |
| `/weighin ask` | Turn the open questions into a session and send you the link |
| `/weighin pull S12` | Read your answers and the brief, then act on them |
| `/weighin log <decision>` | Log one decision now |

### Compaction, three layers deep

1. **The agent saves first.** The skill tells it to flush decisions (`origin: compaction`) before it compacts or suggests compacting.
2. **The hook catches the rest.** On `PreCompact` (Claude Code, Codex, Cursor) or `PreCompress` (Gemini and Antigravity CLI), `weighin hook precompact` sends the new part of the transcript to the server as a capture. If you've configured an extraction model (any OpenAI-compatible endpoint, including a local one), it pulls out decisions the agent missed and skips the ones already logged. In Claude Code the hook also writes instructions into the compaction summary: keep the logged decision ids, and mark anything unlogged.
3. **The next context starts with the brief.** On `SessionStart` after compaction (Claude Code, Codex), the hook injects that session's decisions back into context and tells the agent to log whatever the summary marked as unlogged.

See the [client matrix](integrations/README.md) for exactly what each client supports.

## Self-host

```sh
export WEIGHIN_TOKEN=$(npx weighin token)
docker compose up -d
```

| Variable | Default | |
|---|---|---|
| `WEIGHIN_TOKEN` | none | Bearer token for agents. The web app asks for it once. **Set this on any shared network.** |
| `WEIGHIN_PUBLIC_URL` | | Used in links sent to agents and in push notifications |
| `WEIGHIN_DB` | `~/.weighin/weighin.db` | SQLite file. In Docker: `/data/weighin.db` |
| `WEIGHIN_HUMAN` | | Default name recorded for the human |
| `WEIGHIN_NTFY_URL`, `WEIGHIN_NTFY_TOKEN` | | [ntfy](https://ntfy.sh) topic for pushes when an agent asks and when you finish answering |
| `WEIGHIN_LLM_BASE_URL`, `WEIGHIN_LLM_MODEL`, `WEIGHIN_LLM_API_KEY` | | Any OpenAI-compatible endpoint for extracting decisions from captures. Off by default; captures are still kept. |

Client side: `WEIGHIN_URL`, `WEIGHIN_TOKEN`, and optionally `WEIGHIN_MODEL`, `WEIGHIN_CLIENT`, `WEIGHIN_HUMAN`, `WEIGHIN_PROJECT`.

One Node process, one SQLite file, no native dependencies. Back it up by copying `/data`.

## API

| MCP tool | REST | CLI |
|---|---|---|
| `weighin_ask` | `POST /api/sessions` | `weighin ask file.json` |
| `weighin_answers` | `GET /api/answers` | `weighin answers --session S12` |
| `weighin_log` | `POST /api/decisions` | `weighin log "title" "choice" --size major` |
| `weighin_brief` | `GET /api/brief` | `weighin brief` |
| `weighin_get` | `GET /api/decisions/D4`, `GET /api/sessions/S12` | `weighin get D4` |

Add `?format=text` to any REST read for the compact rendering. The full spec is at `/openapi.json`.

## Development

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

[Apache 2.0](LICENSE). Use it, fork it, ship it in your product. Keep the [NOTICE](NOTICE) file so Josh Holtzclaw is credited.