Skip to content

Commit a8fd71a

Browse files
trilltinoclaude
andcommitted
Add CORAL.md deep dive + link CoralOS docs across code and READMEs
- CORAL.md: source→agents→example walkthrough of the CoralOS integration — the MCP client, agent orchestration, the capabilities only Coral provides (§5, tied to the docs), an end-to-end round, a "how to expand it" section, and a §10 index of the official docs. - Link the official CoralOS docs inline at each referenced point in code: coral/mcp.ts (@see per primitive), coral/server.ts, market/protocol.ts, round.ts + marketplace/start.ts (create-session), bridge/server.ts (puppet + extended state), coral.toml, docker-compose.yml, and the agent manifests. - Add matching doc links to the Coral-facing READMEs (buyer/seller/broker, marketplace, agent-economy, txodds/coral) and the root README. URLs verified against https://docs.coralos.ai/llms.txt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0886aec commit a8fd71a

18 files changed

Lines changed: 519 additions & 9 deletions

File tree

CORAL.md

Lines changed: 421 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ one per concern:
170170
the **devnet guard** that throws on a mainnet RPC unless `ALLOW_MAINNET=1`, so it applies everywhere
171171
value moves.
172172
- **`coral/`** — a CoralOS (MCP) client + agent entrypoint: the coordination fabric the sellers and
173-
buyer meet on.
173+
buyer meet on. Deep dive, source → example: **[CORAL.md](CORAL.md)**; official docs:
174+
[docs.coralos.ai](https://docs.coralos.ai/welcome).
174175
- **`market/`** — the WANT/BID/AWARD wire format: the negotiation protocol, pure and testable.
175176

176177
### The escrow contract — the settlement spine

coral-agents/broker/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ buyer ──"request <service>"──▶ broker
1212
Two on-chain settlements per request; the broker keeps the spread. This is "money flowing through a
1313
graph of agents" — the agent-economy headline.
1414

15+
> **CoralOS docs:** the broker opens **one Coral thread per seller** and correlates each reply per-thread
16+
> [Threads](https://docs.coralos.ai/concepts/threads) +
17+
> [Coordination](https://docs.coralos.ai/concepts/coordination). How it's wired in the kit:
18+
> [/CORAL.md](../../CORAL.md).
19+
1520
## How it works
1621

1722
- Reuses the kit's pieces: `payment.ts` (seller-side — charges the buyer, dynamic price) and

coral-agents/buyer-agent/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ WANT -> BID* -> AWARD
1111
-> ARBITER_RELEASED
1212
```
1313

14+
> **CoralOS docs:** these messages ride Coral threads with `@mentions`
15+
> ([Threads](https://docs.coralos.ai/concepts/threads)); the buyer blocks on bids and waits for sellers
16+
> to come online via [Coordination](https://docs.coralos.ai/concepts/coordination), all inside a
17+
> [Session](https://docs.coralos.ai/concepts/sessions). End-to-end wiring: [/CORAL.md](../../CORAL.md).
18+
1419
`SETTLEMENT_MODE=direct` keeps the legacy base escrow path available, but the TxODDS CoralOS round uses
1520
`SETTLEMENT_MODE=arbiter` so the buyer cannot unilaterally claw back after delivery.
1621

coral-agents/buyer-agent/coral-agent.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Agent manifest — coral-server reads this to discover, launch, and configure the agent.
2+
# Docs: https://docs.coralos.ai/reference/agent · [options] table
3+
# https://docs.coralos.ai/reference/agent/tables/options · docker runtime
4+
# https://docs.coralos.ai/reference/agent/tables/runtimes/docker · whole-kit walkthrough /CORAL.md
15
edition = 4
26

37
[agent]

coral-agents/seller-agent/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ WANT service=txline arg="edge <fixtureId>"
1313
-> DELIVERED {teams, odds, analysis}
1414
```
1515

16+
> **CoralOS docs:** the loop is `wait_for_mention → reply` on a shared thread
17+
> ([Threads](https://docs.coralos.ai/concepts/threads),
18+
> [Coordination](https://docs.coralos.ai/concepts/coordination)); coral-server launches this agent into a
19+
> [Session](https://docs.coralos.ai/concepts/sessions) from its
20+
> [manifest](https://docs.coralos.ai/reference/agent). Kit walkthrough: [/CORAL.md](../../CORAL.md).
21+
1622
The seller only delivers after `isFunded` confirms the escrow names its payout wallet and holds at
1723
least the quoted price. In arbiter mode it checks the escrow buyer as the vault PDA from `DEPOSITED`,
1824
not the human buyer wallet.

coral-agents/seller-agent/coral-agent.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Agent manifest — coral-server reads this to discover, launch, and configure the agent.
2+
# Docs: https://docs.coralos.ai/reference/agent · [options] table
3+
# https://docs.coralos.ai/reference/agent/tables/options · docker runtime
4+
# https://docs.coralos.ai/reference/agent/tables/runtimes/docker · whole-kit walkthrough /CORAL.md
15
edition = 4
26

37
[agent]

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
services:
1212

1313
# ── CoralOS — MCP bus that launches the agents per session ──────────────────
14+
# Docs: running coral-server https://docs.coralos.ai/reference/server/docker · it spawns agent
15+
# containers via the mounted docker.sock (Docker-in-Docker):
16+
# https://docs.coralos.ai/guides/production/docker-in-docker · whole-kit walkthrough /CORAL.md
1417
coral:
1518
# Pinned by digest for reproducibility (what `:latest` resolved to on 2026-06-27). Bump:
1619
# docker pull ghcr.io/coral-protocol/coral-server:latest

examples/agent-economy/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Every payment is a real on-chain **devnet** transaction. CoralOS (coral-server)
88
fabric — a pure MCP message bus. Payments are settled agent-side in SOL, so coral-server runs
99
**stock and wallet-free** (no patched image, no keypair in the server).
1010

11+
> **CoralOS docs:** agents run in a [Session](https://docs.coralos.ai/concepts/sessions) over
12+
> [Threads](https://docs.coralos.ai/concepts/threads); the human "checkout" door injects messages via the
13+
> [Puppet API](https://docs.coralos.ai/api-reference/puppet/send-message) and reads replies from
14+
> [session state](https://docs.coralos.ai/api-reference/local/get-extended-session-state). How it's all
15+
> wired in the kit: [/CORAL.md](../../CORAL.md).
16+
1117
```
1218
┌──────────────────────────┐
1319
│ coral-server :5555 │ stock, wallet-free MCP bus

examples/agent-economy/bridge/server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ function ensureSession(): Promise<string> {
106106
return session
107107
}
108108

109-
/** Inject a message into a thread as user-proxy. */
109+
/**
110+
* Inject a message into a thread AS the user-proxy agent — the human-in-the-loop puppet API.
111+
* @see https://docs.coralos.ai/api-reference/puppet/send-message — send as an agent
112+
* @see https://docs.coralos.ai/guides/integrating-with-your-app — driving Coral from your app
113+
*/
110114
async function inject(sid: string, threadId: string, content: string) {
111115
const res = await fetch(`${BASE}/api/v1/puppet/${NS}/${sid}/user-proxy/thread/message`, {
112116
method: 'POST', headers: AUTH,
@@ -135,6 +139,7 @@ function collectMessages(node: unknown, out: Msg[] = []): Msg[] {
135139
/**
136140
* Poll the extended session state until a message in `threadId` contains `marker`; return its text.
137141
* The puppet API is send-only (no read), so replies are read from the session state instead.
142+
* @see https://docs.coralos.ai/api-reference/local/get-extended-session-state — the transcript endpoint
138143
*/
139144
async function pollThread(sid: string, threadId: string, marker: string, timeoutMs = 35000): Promise<string> {
140145
const deadline = Date.now() + timeoutMs
@@ -167,6 +172,7 @@ app.post('/order', async (req, res) => {
167172
const query = prompt ? `${service} ${prompt}` : service
168173
const sid = await ensureSession()
169174

175+
// Open a thread AS the user-proxy. @see https://docs.coralos.ai/api-reference/puppet/create-thread
170176
const tres = await fetch(`${BASE}/api/v1/puppet/${NS}/${sid}/user-proxy/thread`, {
171177
method: 'POST', headers: AUTH,
172178
body: JSON.stringify({ threadName: `order-${Date.now()}`, participantNames: ['seller-agent'] }),

0 commit comments

Comments
 (0)