Skip to content

Commit 7306e0c

Browse files
committed
Danus: initial open-source release
An automated mathematics proof-search system: a main agent orchestrates a swarm of codex workers; a stateless verifier is the sole authority on correctness; verified results accumulate in a content-addressed fact graph — the system's single source of truth — and are rendered into progress reports and publishable papers.
0 parents  commit 7306e0c

237 files changed

Lines changed: 31336 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/consult/SKILL.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
name: consult
3+
description: Consult a strong reasoning model for strategy — feed it the current elaboration, take its reply as the next master_guidance, and dispatch workers from it. This is the main agent's high-intelligence step (workers prove; the consult decomposes and steers). Runs over the gpt_pro transport (a paid API, default), the claude_api transport (the Anthropic API, per-token BYO key), or the claude_code transport (your Claude subscription); if no key/login is configured it degrades to off, where the main agent reasons on its own. Use it each strategic cycle, on events (a worker finished a round / real new progress), not a blind timer.
4+
---
5+
6+
# Consult for strategy
7+
8+
You are the **main agent**. Workers do the proving; **you do the high-level
9+
thinking by consulting a strong reasoning model and turning its reply into
10+
dispatch.** This is the strategic core of the loop: distil state (the
11+
`elaboration` skill) → consult → record the reply as `master_guidance` → assign
12+
workers from it.
13+
14+
The consult is the **core direction-guidance mechanism** — it is how the swarm
15+
gets steered — and the **only step that costs money** (codex workers + the verify
16+
service are free). Treat it as central, not optional.
17+
18+
## When to consult (events, not a timer)
19+
20+
The gate is **judgment about new state**, not the clock. Consult only when there
21+
is genuinely new state to reason over:
22+
23+
- a worker **finished a round** and produced real new state;
24+
- a **substantive new finding / dead end / verified fact** changed the picture;
25+
- the swarm is **stuck** and needs a new direction.
26+
27+
Do **not** re-consult when nothing material has changed since the last
28+
`master_guidance`. A sensible cadence is **at most once every ~2 hours** — a
29+
consult itself takes minutes, and you want real state to reason over, not churn.
30+
Drive cadence off main-agent events (or your own `/loop`), never a blind timer.
31+
32+
**Spend discipline.** Each API consult costs money and accrues to the project's
33+
running total. Prefer `--effort high` (the workhorse); reserve `xhigh` for genuine
34+
forks. As project spend approaches the operator's ceiling, **surface it — that is a
35+
load-bearing fork** (see the main-agent contract).
36+
37+
**Project start (no record, no direction yet):** do not launch blind. First
38+
**discuss the problem with both the model AND the human**, get direction from both
39+
sides, then start the workers.
40+
41+
## How to consult
42+
43+
1. **Prepare the elaboration first** (the `elaboration` skill): read global memory
44+
+ the fact graph (never worker local memory), produce the five-section
45+
synthesis, and publish it with `gm_add` (kind `elaboration`). That published
46+
document is the consult prompt — never consult on an empty or stale prompt.
47+
48+
2. **Call the consult CLI** with the elaboration as input:
49+
50+
```bash
51+
consult --file <elaboration.md> --project <project_dir> --out <reply.md>
52+
```
53+
54+
- `consult` is the wrapper on PATH — it sources the deployment env and execs
55+
the strategy consult CLI (in `danus/strategy`) with the right Python.
56+
- **Transport** comes from config (`DANUS_CONSULT_TRANSPORT`, default `gpt_pro`); a
57+
per-call override is `--transport gpt_pro|claude_api|claude_code|off`. `gpt_pro`
58+
runs the paid OpenAI-compatible endpoint; `claude_api` runs the native Anthropic
59+
API (per-token, BYO key); `claude_code` runs the consult through the Claude Code
60+
CLI (`claude -p`); `off` short-circuits (see the `off` path below).
61+
- **Effort** (`--effort high|xhigh`, default `high`): `high` is the workhorse,
62+
`xhigh` for the hardest forks.
63+
- `--project` records the spend: one line per call appended to
64+
`<project_dir>/spend/consult.jsonl`, and the CLI returns the running
65+
`project_total_usd`. **Always pass `--project`.**
66+
- It prints a one-line JSON envelope (`transport`, `reply`, `usage.input` /
67+
`usage.output` / `usage.reasoning`, `cost_usd`, `seconds`, `project_total_usd`)
68+
and, with `--out`, writes the full reply as markdown. Field shapes and pricing
69+
are owned by `danus/strategy` — read them there; do not re-derive them here.
70+
- It is a **stateless gateway**: prompt in, reply out. It does **not** write the
71+
stores — you do, in the next step.
72+
73+
3. **Record the reply as `master_guidance`, VERBATIM.** Take the reply as the
74+
direction and publish it unedited:
75+
76+
```
77+
gm_add(kind="master_guidance", claim=<one-line gist of the direction>,
78+
evidence=<the full, unedited reply>,
79+
links={"elaboration_id": <the gm_add id from step 1>},
80+
input_tokens=<usage.input>, output_tokens=<usage.output>, cost_usd=<cost_usd>)
81+
```
82+
83+
The call's `input_tokens` / `output_tokens` / `cost_usd` from the envelope ride
84+
as extra fields, so each consult's cost sits next to what it bought. The
85+
`master_guidance` schema (field names, `verifiable=false`) is owned by
86+
`danus/core` (`DATA_MODEL.md`) — honor it, don't re-specify it.
87+
88+
`master_guidance` is **strategy, not truth**: it is `verifiable=false`. Workers
89+
heed it each round for awareness, but it is **never a correctness source** — only
90+
the fact graph is. Do not edit the reply into your own opinion; **dispatch is
91+
where your judgment enters.** Wrong guidance is simply superseded by the next
92+
consult — **never `fact_revoke` it** (revoke cascades on *facts* only).
93+
94+
4. **Dispatch from it** (see the main-agent contract's command surface). If the
95+
reply names **distinct branches/directions**, put **different workers on
96+
different directions** by writing each a `TASK.md` with `danus assign`; if there
97+
are **fewer branches than workers**, multiple workers on one subgoal is fine.
98+
99+
5. **Keep the human informed** at the right severity (the elaboration + the
100+
consulted direction is what you summarize up, in the operator's language per
101+
`OPERATOR.md`). Surface the load-bearing forks (finalizing a result,
102+
cascade-revoke, posting outward, over-ceiling spend).
103+
104+
## The `off` path (no-key degrade — not the norm)
105+
106+
The strong-model consult is core. When `DANUS_CONSULT_TRANSPORT=off` (e.g. no key is
107+
configured, or the operator disabled it), the consult short-circuits and this skill
108+
degrades: **the main agent reasons on its own** from the elaboration, then records
109+
that reasoning as `master_guidance` (step 3) with `cost_usd=0` and **explicitly
110+
flagged as self-authored** — never fabricated from thin air. Everything else
111+
(events-not-timer, verbatim recording of what you decided, dispatch, human
112+
updates) is unchanged. This is a real fallback mode, not the default.
113+
114+
## Totaling spend
115+
116+
The consult meters its own spend; codex workers and the verify service run
117+
separately on the operator's own codex backend. **Every** transport meters it:
118+
`gpt_pro`, `claude_api`, and `claude_code` each compute `cost_usd = input/output
119+
tokens × per-1M rate` (`gpt_pro`: `DANUS_CONSULT_PRICE_IN`/`_OUT`; `claude_api`:
120+
`DANUS_CONSULT_CLAUDE_API_PRICE_IN`/`_OUT`, from the response's REAL usage; `claude_code`:
121+
`DANUS_CONSULT_CLAUDE_CODE_PRICE_IN`/`_OUT`
122+
— set these to your real model/plan rate; `off` is the only $0 transport). So
123+
**project spend = the sum of `cost_usd` over consult calls**, recorded in two places:
124+
125+
- the **spend ledger** `<project>/spend/consult.jsonl` — one line per call
126+
(model / effort / transport-attempt / tokens / `cost_usd`), written by
127+
`--project`; the CLI also returns the running `project_total_usd`.
128+
- the **`master_guidance` entries** in global memory — each carries its call's
129+
`input_tokens` / `output_tokens` / `cost_usd`.
130+
131+
**How you (main agent) check spend:** read `project_total_usd` from each consult's
132+
envelope (or sum `cost_usd` over `<project>/spend/consult.jsonl`). Report the
133+
running total in your `spend` summary and warn the operator as it approaches their
134+
ceiling. The rates live in config (a rate change touches one env pair, not code).
135+
136+
## Discipline
137+
138+
The load-bearing rules are stated where they apply above (verbatim recording,
139+
events-not-a-timer, cost on every call, guidance-is-never-truth). Two more that
140+
belong nowhere else:
141+
142+
- **One main agent at a time** owns `master_guidance` — do not race two.
143+
- **Setup:** the `gpt_pro` transport needs an OpenAI-compatible endpoint + key, and
144+
`claude_api` an Anthropic key (both BYO, in `config/danus.env` via the
145+
`DANUS_CONSULT_*` vars); `off` is a no-key degrade. If the
146+
key/quota is exhausted, that is an operator fork, not something to work around.

0 commit comments

Comments
 (0)