Public: anyone can read this; the crew can change it.

Thought intake: a forge-level tell, from the composer, the API and the MCP, kept verbatim in an append-only ledger #805

Closed opened this in answer to
Closed without merging

A thought said to the forge itself, rather than to one app, now has somewhere to go. It is kept exactly as typed, with who said it, the source and the time, in a ledger that can only be appended to.

Notes

stopped closed without shipping deploy bec50a9

opened this

A thought said to the forge itself, rather than to one app, now has somewhere to go. It is kept exactly as typed, with who said it, the source and the time, in a ledger that can only be appended to.

What changed

  • Ledger: migration 48 adds a thought table with id, author, text, source (composer, api, mcp, share) and received_at. Two triggers refuse any UPDATE or DELETE, from any code. src/core/thoughts.ts only inserts and reads.
  • Action: tellForge in src/actions/thoughts.ts writes the thought and a thought.received { thought, source } event in one transaction. The event carries the id but never the words; triage (the next issue) will read the text from the table. Empty and repeated text are each stored as their own row. Agents are refused, because a thought belongs to a person. Text over 20,000 characters is refused with an error and is never cut short.
  • Three ways in:
    • POST /api/v1/thoughts {text} needs an rw token or a same-origin session and returns 201 {id, received_at}.
    • MCP tell with no repo writes a thought and returns its id. With a repo, it still tells that app as before.
    • A composer now sits above the home feed: a text box, a "To" picker and Send. "The forge" is the default choice, followed by every app the viewer can write; picking an app is the same tell as that app's own box. It posts to /thoughts (now a reserved name) and returns to /.
  • Feed: the viewer's last three thoughts sit on top of the feed as their own posts, marked received, with line breaks kept and the text escaped. docs/FEED.md and docs/MCP.md describe all of this.

Test changed: test/mcp.test.ts asserted that tell required ["repo", "text"]. The issue changes that on purpose, so it now asserts ["text"].

Tests: test/thoughts.test.ts is added to the gate. It covers:

  • exact round-trips of awkward text (CRLF, tabs, a bidi mark, markup) through each way in;
  • empty and repeated text being kept;
  • the refusals (not a string, too long, read-only token, agent, signed out, another origin);
  • the triggers refusing an update and a delete, plus a scan of src/ showing no code updates or deletes the table;
  • the event's shape;
  • a VACUUM INTO copy holding every thought, which is how backups are made.

The full gate passed: 1449 tests, none failing, with the ssh-dependent tests skipped as usual. tsc --noEmit is clean.

Not done

  • Triage, where a thought later shows where it went, is the next issue.
  • GET /api/v1/feed does not list thoughts; they appear only on the page.
  • The live feed doesn't refresh on its own when a thought arrives, because events with no repository aren't streamed. Sending reloads /, so the new post shows anyway.
  • The phone and desktop screenshots come from this pull's preview; I did not take them here.

Removes: nothing. The home gains one composer; there is no new screen.

To try it: sign in, type into the box at the top of the home with "the forge" chosen, and press Send; the post appears at the top of the feed. Or call curl -X POST -H "authorization: Bearer $TOKEN" -d '{"text":" as typed "}' $FORGE/api/v1/thoughts, or MCP tell {"text": "…"} with no repo.

🤖 Generated with Claude Code

Closes #651

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs