Skip to content

Commit 68b46a2

Browse files
committed
Polish docs and arbiter language
1 parent c39bf8b commit 68b46a2

38 files changed

Lines changed: 489 additions & 394 deletions

JUDGE_FIX_PLAN.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The remaining items are external setup (fund a live LLM provider) or larger foll
1414
| P0 | LLM is currently fallback | The thesis is "AI agents buying/selling reads"; deterministic fallback weakens the product story on video. | External: top up Anthropic or set `LLM_PROVIDER=openai` with a funded OpenAI key. | S |
1515
| P1 | Market is effectively 1:1 | One buyer plus one seller is coordination, not a market. | Done: `round.ts` launches three TxODDS seller personas; specialist is priced to win. | S |
1616
| P1 | Seller agent has legacy generic services | CoinGecko/Jupiter/news code distracts from the TxODDS story. | Done: `service.ts` is TxODDS-only and seller docs describe legacy helpers as outside the loop. | S |
17-
| P1 | Arbiter is centralized | One proxy-controlled arbiter key makes "trustless" easy to challenge. | Done in docs: described as arbiter-gated with a trusted neutral arbiter, not decentralized arbitration. | S |
17+
| P1 | Arbiter is centralized | One proxy-controlled arbiter key makes overbroad settlement claims easy to challenge. | Done in docs: described as arbiter-gated with a trusted neutral arbiter. | S |
1818
| P2 | Product value is thin | The read restates de-margined odds; there is not yet a real betting edge. | Be honest now; stretch goal is bookmaker comparison for true edge. | L |
1919
| P2 | No Rust CI | Devnet tests cannot run in Actions, so contract regressions are not caught in CI. | Add LiteSVM/Mollusk contract tests. | M |
2020
| P2 | Free TxLINE tier is brittle | Intermittent feed/tokens can undermine demos. | Keep fallback data, document the dependency, and prefer a warmed token/session before recording. | S |
@@ -97,13 +97,12 @@ base escrow path. That means the best innovations are absent from the multi-agen
9797

9898
## P1: Tighten Arbiter Language
9999

100-
**Problem:** a single arbiter key controlled by the proxy is not decentralized.
100+
**Problem:** a single arbiter key controlled by the proxy is a trusted neutral party.
101101

102102
**Fix:**
103103

104-
- Avoid saying simply "trustless" without qualification.
105-
- Prefer "arbiter-gated", "buyer cannot unilaterally claw back", and "trustless between buyer and seller, with a trusted neutral arbiter".
106-
- Document production upgrades: staked arbiters, multisig arbiters, decentralized oracle set.
104+
- Avoid wording that implies the arbiter has no trusted keypair.
105+
- Prefer "arbiter-gated", "buyer cannot unilaterally claw back", and "trusted neutral arbiter".
107106

108107
## P2: Product Depth
109108

LLM.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
# LLMs what they do, and how to switch provider / keys
1+
# LLMs - what they do, and how to switch provider / keys
22

3-
The kit is **provider-agnostic**. One shim [`packages/agent-runtime/src/llm/complete.ts`](packages/agent-runtime/src/llm/complete.ts)
4-
makes a single `fetch` call (no vendor SDK) and supports **Anthropic** (default) and **OpenAI**. You
5-
flip the whole demo between them with **env vars only no code change**.
3+
The kit is **provider-agnostic**. One shim - [`packages/agent-runtime/src/llm/complete.ts`](packages/agent-runtime/src/llm/complete.ts)
4+
- makes a single `fetch` call (no vendor SDK) and supports **Anthropic** (default) and **OpenAI**. You
5+
flip the whole demo between them with **env vars only - no code change**.
66

77
## Where the LLM is used
88

99
| Where | What it does | Falls back to |
1010
|-------|--------------|---------------|
11-
| **The read** `analyzeEdge()` ([`agent/edge.ts`](examples/txodds/agent/edge.ts)) `complete()` | turns the verified fair line into a one-line read + confidence | a **deterministic** read (favourite by probability) so the demo never breaks |
12-
| **The CoralOS round** the seller's `edge` delivery ([`coral-agents/seller-agent`](coral-agents/seller-agent)) | the seller runs the same edge over MCP | a deterministic delivery |
11+
| **The read** - `analyzeEdge()` ([`agent/edge.ts`](examples/txodds/agent/edge.ts)) -> `complete()` | turns the verified fair line into a one-line read + confidence | a **deterministic** read (favourite by probability) - so the demo never breaks |
12+
| **The CoralOS round** - the seller's `edge` delivery ([`coral-agents/seller-agent`](coral-agents/seller-agent)) | the seller runs the same edge over MCP | a deterministic delivery |
1313

1414
If there's **no key (or the account is out of credits)**, the call throws and the code uses the
1515
deterministic fallback. The web UI shows a **`deterministic`** badge instead of `LLM` so you can tell.
1616

1717
## The env vars
1818

19-
All live in the repo-root **`.env`** (gitignored never committed). `.env.example` shows the empty fields.
19+
All live in the repo-root **`.env`** (gitignored - never committed). `.env.example` shows the empty fields.
2020

2121
| Var | Meaning |
2222
|-----|---------|
23-
| `ANTHROPIC_API_KEY` | Anthropic key (`sk-ant-`). The default provider. |
24-
| `OPENAI_API_KEY` | OpenAI key (`sk-`). |
23+
| `ANTHROPIC_API_KEY` | Anthropic key (`sk-ant-...`). The default provider. |
24+
| `OPENAI_API_KEY` | OpenAI key (`sk-...`). |
2525
| `LLM_PROVIDER` | Force the provider: `anthropic` or `openai`. Optional. |
2626
| `LLM_MODEL` | Override the model id. Optional (sensible per-provider default otherwise). |
27-
| `TRACE` | `1` log the chosen provider/model + the raw reply. |
27+
| `TRACE` | `1` -> log the chosen provider/model + the raw reply. |
2828

2929
## How the provider is chosen
3030

3131
[`pickProvider()`](packages/agent-runtime/src/llm/complete.ts) resolves it in this order:
3232

33-
1. **Explicit** if `LLM_PROVIDER=openai` (or `anthropic`), use that.
34-
2. **Auto-detect** else if `OPENAI_API_KEY` is set, use **OpenAI**.
35-
3. **Default** else **Anthropic**.
33+
1. **Explicit** - if `LLM_PROVIDER=openai` (or `anthropic`), use that.
34+
2. **Auto-detect** - else if `OPENAI_API_KEY` is set, use **OpenAI**.
35+
3. **Default** - else **Anthropic**.
3636

37-
Default models (override with `LLM_MODEL`): Anthropic `claude-haiku-4-5-20251001` · OpenAI `gpt-4o-mini`.
37+
Default models (override with `LLM_MODEL`): Anthropic `claude-haiku-4-5-20251001` - OpenAI `gpt-4o-mini`.
3838

39-
## Switch it copy/paste
39+
## Switch it - copy/paste
4040

4141
**Anthropic (default):**
4242
```ini
43-
ANTHROPIC_API_KEY=sk-ant-
43+
ANTHROPIC_API_KEY=sk-ant-...
4444
# LLM_PROVIDER / OPENAI_API_KEY unset
4545
```
4646

4747
**OpenAI:**
4848
```ini
4949
LLM_PROVIDER=openai
50-
OPENAI_API_KEY=sk-
50+
OPENAI_API_KEY=sk-...
5151
```
5252

5353
**Pin a specific model:**
5454
```ini
55-
ANTHROPIC_API_KEY=sk-ant-
55+
ANTHROPIC_API_KEY=sk-ant-...
5656
LLM_MODEL=claude-opus-4-8
5757
```
5858

@@ -61,15 +61,15 @@ LLM_MODEL=claude-opus-4-8
6161
Edit `.env`, then **restart** so it's re-read:
6262

6363
- **Web demo:** restart `npm run dev` (the proxy reads `.env` at startup).
64-
- **CoralOS round:** just re-run `npm run coral` `coral/round.ts` reads `.env` and passes the keys to
64+
- **CoralOS round:** just re-run `npm run coral` - `coral/round.ts` reads `.env` and passes the keys to
6565
the agents in the session request, so coral-server launches them with the new provider/key.
6666

6767
## "It says `deterministic`, not `LLM`"
6868

6969
The model didn't return. Almost always the key:
7070

7171
- not set / wrong key, or
72-
- **out of credits** Anthropic returns `400 credit balance is too low`. Top up, swap the key, or
72+
- **out of credits** - Anthropic returns `400 ... credit balance is too low`. Top up, swap the key, or
7373
switch to OpenAI (above). Then restart.
7474

7575
Run with `TRACE=1` in `.env` to see exactly which provider/model was used and the raw reply.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Polish And Arbiter Language Plan
2+
3+
This tracks the two remaining judge-facing weaknesses after the CoralOS arbiter alignment work:
4+
5+
1. Some older docs/comments contain mojibake, mostly from copied arrows/dashes.
6+
2. The arbiter is a single trusted keypair, so the repo language must not overclaim.
7+
8+
## Priority
9+
10+
| Priority | Issue | Why It Matters | Fix |
11+
|---|---|---|---|
12+
| P0 | Mojibake in docs/comments | It makes the repo look rushed even when the system is strong. | Normalize docs and comments to clean ASCII or valid UTF-8. |
13+
| P1 | Centralized arbiter language | A sharp judge can challenge overbroad settlement claims. | Make language precise and consistent. |
14+
15+
## P0: Mojibake Cleanup
16+
17+
**Goal:** the repo should read cleanly in GitHub, terminals, and IDEs.
18+
19+
**Scope:**
20+
21+
- Markdown docs
22+
- `coral-agent.toml` descriptions
23+
- Source comments and log strings
24+
- README snippets and diagrams
25+
26+
**Likely search patterns:**
27+
28+
```sh
29+
rg -n "[^\\x00-\\x7F]" README.md LLM.md coral-agents examples/txodds packages scripts
30+
```
31+
32+
**Rules:**
33+
34+
- Prefer ASCII in docs and comments unless a file is already intentionally Unicode-clean.
35+
- Replace mojibake arrows with `->`.
36+
- Replace mojibake em dashes with `-`.
37+
- Replace curly quotes with straight quotes.
38+
- Replace box drawing diagrams with fenced ASCII diagrams.
39+
- Do not touch generated lockfiles or binary assets.
40+
41+
**Acceptance Criteria:**
42+
43+
- `rg -n "[^\\x00-\\x7F]" ...` returns no meaningful repo-authored docs/comments.
44+
- Main READMEs render cleanly on GitHub.
45+
- No behavior changes.
46+
- Typechecks still pass.
47+
48+
## P1: Arbiter Language Tightening
49+
50+
**Current truth:** the arbiter makes settlement fairer between buyer and seller, but it is still a trusted
51+
neutral keypair. The repo should say that directly.
52+
53+
**Approved language:**
54+
55+
- "arbiter-gated escrow"
56+
- "buyer cannot unilaterally claw back after delivery"
57+
- "trusted neutral arbiter"
58+
- "trusted neutral arbiter"
59+
60+
**Avoid:**
61+
62+
- Any wording that implies arbitration has no trusted keypair.
63+
- Any wording that implies the system has no trusted neutral party.
64+
- Any wording that says both sides are fully protected without naming the arbiter trust assumption.
65+
66+
**Files to audit:**
67+
68+
- `README.md`
69+
- `examples/txodds/README.md`
70+
- `examples/txodds/coral/README.md`
71+
- `examples/txodds/escrow/README.md`
72+
- `examples/txodds/web/app.js`
73+
- `coral-agents/**/*.md`
74+
- `coral-agents/**/*.toml`
75+
76+
**Acceptance Criteria:**
77+
78+
- Every settlement claim is qualified.
79+
- The trusted-arbiter assumption is visible before any judge reaches the contract section.
80+
- README clearly says the arbiter is trusted/centralized in this demo.
81+
82+
## Recommended Path
83+
84+
1. Do P0 mojibake cleanup immediately.
85+
2. Do P1 language tightening immediately.
86+
87+
## Verification Checklist
88+
89+
```sh
90+
rg -n "[^\\x00-\\x7F]" README.md LLM.md coral-agents examples/txodds packages scripts
91+
npm run typecheck --prefix packages/agent-runtime
92+
npm run typecheck --prefix coral-agents/buyer-agent
93+
npm run typecheck --prefix coral-agents/seller-agent
94+
npm run typecheck --prefix examples/txodds
95+
```
96+
97+
If only docs/comments change, tests are optional but typechecks should remain green.

0 commit comments

Comments
 (0)