InvestmentPlan Server

Version-controlled org-mode investment plan, readable and writable by AI agents anywhere. Every write is optimistic-concurrency-checked (expectedVersion) — a stale write gets HTTP 409, never a silent overwrite.

Concurrency

Every write (POST /update, GET /update-line) requires expectedVersion equal to the plan's current version (read it from GET /plan's X-Plan-Version header, or GET /changelog[0].version). A mismatch returns 409 {ok:false, conflict:true, currentVersion} — refetch and retry with the new version.

Routes

GET /plan

Fetch the current plan content.
Response: text/plain org content; headers X-Plan-Version, X-Plan-Sha256, Last-Modified.

GET /view

Same content as /plan, wrapped as an HTML page for clients that only render HTML (e.g. some AI browsing tools).
Response: text/html; same X-Plan-Version/X-Plan-Sha256/Last-Modified headers as /plan.

GET /changelog

Recent version history, newest first.
Query: limit — optional integer, default 50.
Response: JSON array of {version, at, author, note}.

GET /version/:id

Fetch one historical version by its version number.
Response: JSON {version, createdAt, author, note, sha256, content}.

POST /update

Full-content replace.
Body:

GET /update-line

Small line-range patch — cheaper than a full replace for a targeted edit.
Query:

Examples

curl https://info.calculateit.dev/plan
curl https://info.calculateit.dev/changelog?limit=5
curl -X POST https://info.calculateit.dev/update -H 'Content-Type: application/json' -d '{"content":"...","expectedVersion":5}'
curl -G https://info.calculateit.dev/update-line --data-urlencode 'version=5' --data-urlencode 'op=insert' --data-urlencode 'line_start=120' --data-urlencode 'text=* New heading'