This repository contains a lightweight Trello toolkit for a prompt-contract workflow:
- Read cards from selected lists.
- Post initial prompt-contract comments when a card is missing one.
- Build a local inbox of cards that need review after new human comments.
- Surface stale
To-DoandIn Progresscards for proactive follow-up on a cooldown. - Refresh a webhook-first active inbox, with polling only as scheduled reconciliation.
- Move cards between
To-Do,In Progress,Blocked, andDone. - Receive Trello webhooks, verify signatures, and queue follow-up work.
The toolkit supports both polling and a webhook-ready event layer. Deployment details stay in local environment files and are not committed.
.env.local: local Trello credentials and board settings. This file is git-ignored.src/commands/snapshot.mjs: fetches the current board state and writesdata/board-snapshot.json.src/commands/bootstrap-contracts.mjs: posts prompt-contract comments to cards that do not already have one.src/commands/refresh-inbox.mjs: refreshesdata/trello-active-inbox.jsonfrom webhook activity first, and only falls back to poll when reconciliation is due.src/commands/poll-once.mjs: buildsdata/trello-inbox.jsonwith cards that need review.src/commands/post-comment.mjs: posts a comment to a Trello card.src/commands/move-card.mjs: moves a card to a named list.src/commands/webhook-server.mjs: runs the local Trello webhook receiver.src/commands/register-webhook.mjs: registers a board webhook once you have a public callback URL.src/commands/drain-webhook-queue.mjs: turns queued webhook events into a card inbox.src/commands/sync-oracle-webhook-inbox.mjs: optionally drains a remote webhook queue over SSH and copies the resulting inbox back to the local workspace.
- Create a
.env.localfile from.env.example. - Fill in your Trello API key, API secret, token, and board details locally.
- When you are ready for webhook ingress, replace
TRELLO_WEBHOOK_CALLBACK_URLwith a public HTTPS URL that points to your webhook server.
Authorization URL template:
https://trello.com/1/authorize?expiration=never&scope=read,write&response_type=token&name=Codex%20Trello%20Agent&key=<your key>
Never commit .env.local or any real credentials.
Run one board snapshot:
npm run trello:snapshotPost missing prompt contracts to existing cards in the target lists:
npm run trello:contractsBuild the local inbox of cards that need follow-up after new human activity:
npm run trello:pollBy default, trello:poll also re-queues stale To-Do and In Progress cards once every 24 hours so active cards do not disappear from the workflow after the initial contract exchange.
Refresh the active inbox using webhook activity first, with polling only as a twice-daily reconciliation backstop:
npm run trello:refreshRun the local webhook receiver:
npm run trello:webhook:serveList currently registered Trello webhooks for this token:
npm run trello:webhook:listRegister a board webhook after you have a public callback URL:
npm run trello:webhook:register -- --callback-url "https://your-public-host.example/trello/webhook"Drain queued webhook events into data/trello-webhook-inbox.json:
npm run trello:webhook:drainIf webhook ingress is hosted remotely, sync the remote inbox down to this workspace:
npm run trello:webhook:sync-oraclePost a comment from stdin:
'Agent reply text' | npm run trello:comment -- --card <card-id>Move a card by target list name:
npm run trello:move -- --card <card-id> --list "In Progress"- Run the webhook receiver on a public endpoint.
- Register one board webhook against that endpoint.
- Let the receiver append validated events to the remote webhook queue.
- Run
npm run trello:refreshso webhook activity is processed first. - Let
npm run trello:refreshinvokenpm run trello:pollonly when the reconciliation interval is due.
This split keeps Trello API access inside small local commands and leaves language reasoning to the agent layer.
npm run trello:refresh treats webhook-triggered card changes as the normal source of work. It only runs the polling workflow when no webhook work is available and the reconciliation interval has elapsed.
- Default reconciliation interval: 12 hours
- Override with
TRELLO_RECONCILIATION_POLL_INTERVAL_HOURS
These intervals control how often unchanged active cards can reappear in the inbox as proactive needs_review items:
TRELLO_TODO_REVIEW_INTERVAL_HOURSdefault: 24TRELLO_IN_PROGRESS_REVIEW_INTERVAL_HOURSdefault: 24
Trello validates webhook callback URLs by making an HTTP HEAD request and expecting a 200 response. Localhost URLs will not work for registration. You can still run the server locally now and later put it behind a public HTTPS endpoint or tunnel, then register the webhook.