Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
---
|
|
|
|
|
title: Decisions
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
```js
|
2026-02-24 23:19:26 +01:00
|
|
|
const API = "http://127.0.0.1:8000";
|
|
|
|
|
const POLL = 15_000;
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```js
|
2026-02-24 23:19:26 +01:00
|
|
|
const decState = (async function*() {
|
|
|
|
|
while (true) {
|
|
|
|
|
let data = [], ok = false;
|
|
|
|
|
try {
|
|
|
|
|
const r = await fetch(`${API}/decisions/?limit=500`);
|
|
|
|
|
ok = r.ok;
|
|
|
|
|
data = ok ? await r.json() : [];
|
|
|
|
|
} catch {}
|
|
|
|
|
yield {data, ok, ts: new Date()};
|
|
|
|
|
await new Promise(res => setTimeout(res, POLL));
|
|
|
|
|
}
|
|
|
|
|
})();
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```js
|
2026-02-24 23:19:26 +01:00
|
|
|
const data = decState.data ?? [];
|
|
|
|
|
const _ok = decState.ok ?? false;
|
|
|
|
|
const _ts = decState.ts;
|
|
|
|
|
const pending = data.filter(d => d.decision_type === "pending");
|
|
|
|
|
const made = data.filter(d => d.decision_type === "made");
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
```
|
|
|
|
|
|
2026-02-24 23:19:26 +01:00
|
|
|
# Decisions
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
|
|
|
|
|
```js
|
2026-02-24 23:19:26 +01:00
|
|
|
display(html`<div class="live-bar">
|
|
|
|
|
<span style="color:${_ok ? 'var(--theme-foreground-focus)' : 'red'}">●</span>
|
|
|
|
|
${_ok
|
|
|
|
|
? `Live · updated ${_ts?.toLocaleTimeString()}`
|
|
|
|
|
: `<span style="color:red">Offline — run: <code>make api</code></span>`}
|
|
|
|
|
</div>`);
|
|
|
|
|
```
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
|
2026-02-24 23:19:26 +01:00
|
|
|
```js
|
|
|
|
|
const tab = view(Inputs.select(["Pending", "Made"], {label: "View"}));
|
|
|
|
|
```
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
|
2026-02-24 23:19:26 +01:00
|
|
|
```js
|
|
|
|
|
const shown = tab === "Pending" ? pending : made;
|
|
|
|
|
|
|
|
|
|
display(Inputs.table(shown.map(d => ({
|
|
|
|
|
Title: d.title,
|
|
|
|
|
Status: d.status + (d.escalation_note ? " ⚠️" : ""),
|
|
|
|
|
Decided_by: d.decided_by ?? "—",
|
|
|
|
|
Deadline: d.deadline ? new Date(d.deadline).toLocaleDateString() : "—",
|
|
|
|
|
Rationale: (d.rationale ?? "").slice(0, 80),
|
|
|
|
|
Updated: new Date(d.updated_at).toLocaleDateString(),
|
|
|
|
|
})), {rows: 30}));
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
if (tab === "Pending" && pending.filter(d => d.escalation_note).length > 0) {
|
|
|
|
|
display(html`<div class="escalation-box">
|
|
|
|
|
<strong>⚠️ Escalated decisions require human approval before any action is taken (constitution §4).</strong>
|
2026-02-24 23:19:26 +01:00
|
|
|
<ul>${pending.filter(d => d.escalation_note).map(d =>
|
|
|
|
|
html`<li><b>${d.title}</b>: ${d.escalation_note}</li>`)}</ul>
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
</div>`);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2026-02-24 23:19:26 +01:00
|
|
|
## Resolution Velocity
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
import * as Plot from "npm:@observablehq/plot";
|
|
|
|
|
|
|
|
|
|
const resolved = made.filter(d => d.decided_at);
|
|
|
|
|
const byMonth = Object.entries(
|
|
|
|
|
resolved.reduce((acc, d) => {
|
|
|
|
|
const m = d.decided_at.slice(0, 7);
|
|
|
|
|
acc[m] = (acc[m] ?? 0) + 1;
|
|
|
|
|
return acc;
|
|
|
|
|
}, {})
|
|
|
|
|
).map(([month, count]) => ({month, count}));
|
|
|
|
|
|
|
|
|
|
display(byMonth.length === 0
|
|
|
|
|
? html`<p style="color:gray">No resolved decisions yet.</p>`
|
|
|
|
|
: Plot.plot({
|
|
|
|
|
title: "Decisions resolved per month",
|
|
|
|
|
x: {label: "Month", tickRotate: -30},
|
|
|
|
|
y: {label: "Count", grid: true},
|
|
|
|
|
marks: [
|
|
|
|
|
Plot.barY(byMonth, {x: "month", y: "count", fill: "steelblue", tip: true}),
|
|
|
|
|
Plot.ruleY([0]),
|
|
|
|
|
],
|
|
|
|
|
marginBottom: 60,
|
|
|
|
|
width: 700,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
```
|
|
|
|
|
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
<style>
|
2026-02-24 23:19:26 +01:00
|
|
|
.live-bar { font-size: 0.8rem; color: gray; text-align: right; margin-bottom: 0.5rem; }
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
.escalation-box { background: #fff3cd; border: 2px solid orange; border-radius: 8px; padding: 1rem; margin-top: 1rem; }
|
|
|
|
|
</style>
|