| 1 | # A capability that survives its first task |
| 2 | |
| 3 | Two real Codewhale tasks use DeepSeek, a TypeScript MCP server and Python. The |
| 4 | first task inspects build-duration fixtures, chooses a detector's sensitivity |
| 5 | and publishes an immutable analysis rule. Its processes exit. A fresh task |
| 6 | discovers the admitted rule by content hash and uses it on a later batch. |
| 7 | |
| 8 | Python retains the training profile between calls in the first task. The later |
| 9 | task starts a new Python process and restores the saved rule, not Python memory |
| 10 | or conversation history. TypeScript handles the MCP contract, validation, |
| 11 | publication and expiry. Codewhale's existing Rust Engine owns model turns, |
| 12 | provider routing, tool admission, session capture and usage receipts. |
| 13 | |
| 14 | This is the smallest runnable example of a useful result becoming a capability |
| 15 | for future work. The agent chooses the rule's parameters, name and rationale; |
| 16 | the operator supplies the permitted statistical operations and resource limits. |
| 17 | It does not install agent-written executable code or establish emergent |
| 18 | behavior. The data is synthetic; the API calls and computations are real. |
| 19 | |
| 20 | ## Run |
| 21 | |
| 22 | Use macOS or Linux, Python 3.11+, Node.js 22.18+ and a current Codewhale binary |
| 23 | with `exec --allowed-tools`, `--max-turns` and stream JSON support. Install the |
| 24 | pinned demo dependencies: |
| 25 | |
| 26 | ```sh |
| 27 | cd docs/examples/whalenet-reuse |
| 28 | npm ci --ignore-scripts |
| 29 | npm run check |
| 30 | python3 run.py --binary /absolute/path/to/codewhale --output /absolute/path/to/new-receipt-directory |
| 31 | ``` |
| 32 | |
| 33 | This makes paid DeepSeek API calls. Supply `DEEPSEEK_API_KEY` in the launching |
| 34 | environment, or explicitly add `--codewhale-secret-store` with the path to an |
| 35 | existing private Codewhale secret store. The runner reads that key into memory |
| 36 | and passes it only to Codewhale. It never writes the key to demo files. The |
| 37 | Engine sanitizes the MCP child environment; the server refuses to start if the |
| 38 | DeepSeek key reaches it. No existing account configuration is modified. |
| 39 | |
| 40 | Each task has a fresh workspace and Codewhale state directory. It permits only |
| 41 | its two MCP tools; exact names in an allowlist are loaded eagerly. The creator uses the |
| 42 | workspace-write posture and the consumer read-only. No shell, file, subagent or |
| 43 | general network tool is admitted to either model. |
| 44 | |
| 45 | The server is operator-authored local code running with the user's OS identity. |
| 46 | MCP processes are not made hostile-code sandboxes by the model's tool allowlist |
| 47 | or the CLI's shell sandbox. The server itself confines its domain writes to the |
| 48 | explicit output directory and exposes no arbitrary path, code or command input. |
| 49 | It writes audit logs there in both roles. Review this code before admitting it |
| 50 | to an account; it is not an automatically trusted extension or plugin. |
| 51 | |
| 52 | ## Read the result |
| 53 | |
| 54 | `summary.json` names the binary and source hashes, both terminal receipts, the |
| 55 | capability hash and later measurements. `creator-stream.jsonl` and |
| 56 | `consumer-stream.jsonl` preserve actual model/tool events and session capture |
| 57 | IDs. The role-specific MCP logs record Node and Python PIDs, Python call |
| 58 | sequence numbers and capability publication/use. The capability is the JSON |
| 59 | file whose name is its SHA-256 digest. |
| 60 | |
| 61 | A successful run verifies that the creator used one Python process across |
| 62 | multiple calls, both creator processes stopped, the consumer started a fresh |
| 63 | session and worker, and the consumer reused the same hash to flag the 142-second |
| 64 | compile and 280-second integration samples. The 60-second compile and |
| 65 | 122-second integration samples remain below the selected thresholds. Failures |
| 66 | leave their receipts in place and do not trigger a paid retry. |
| 67 | |
| 68 | Each task is limited to six model steps, two tool calls per step, 4,096 output |
| 69 | tokens per response and 180 seconds. The server admits twelve calls, gives |
| 70 | Python five seconds per operation, and expires after the shared one-hour lease. |
| 71 | Invalid parameters, missing training state, changed implementation hashes, |
| 72 | tampered capabilities and expired capabilities are refused. Consumer processes |
| 73 | do not register the publication tool. Cancellation closes the Python worker; |
| 74 | later calls require a new server process. |
| 75 | |
| 76 | ## Where WhaleNet fits |
| 77 | |
| 78 | This demo uses local stdio. [Environment placement](../../ENVIRONMENTS.md#environment-aware-fleet-placement-preview) |
| 79 | selects where a Fleet task may execute; its Tailscale transport addresses an |
| 80 | explicitly enrolled peer by node identity. This example does not connect those |
| 81 | two paths into a distributed capability service. Cross-host discovery, |
| 82 | recipient consent, quotas and independent-owner isolation remain subsequent |
| 83 | work. ShannonNet is not a dependency. |
| 84 |