Skip to content
Merged
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# spacesheep CLI

## Every argument is in the schema

A command that calls spacesheep is generated from the server's doors table
(`lib/doors.js`), which is built from `proto/spacesheep/v1/` in
[spacesheep-dev/spacesheep](https://github.com/spacesheep-dev/spacesheep). A new call,
input or field goes in that `.proto` first. Never add a hand-written verb, flag or request
body for it, or a key in a free-form map like the session's `extra`: a value the CLI sends
on an existing call uses a declared field of that call's message (James, 2026-12-02, EXT-198).
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ start itself:
spacesheep talk on # your account's switch, and this machine's opt-in
spacesheep talk listen --once # waits for the next message, prints it, exits (run it in the background)
spacesheep talk reply --to 19 "done" # answer message 19 in the Session tab
spacesheep talk-steps create --reply-to 19 --text "Editing the intro" # what it's doing now, shown in the tab
spacesheep talk-steps create --reply-to 19 --done # the run ended
```

Each message the listener prints carries its `id`. Pass it with `--to`, so the answer
Expand Down Expand Up @@ -508,6 +510,10 @@ connected and they all keep working.
`SPACESHEEP_KEY` in the environment wins over the stored login. That is how CI
authenticates. Keys are created and revoked at <https://spacesheep.dev/settings>.

`SPACESHEEP_AGENT_NAME` names the agent a deploy comes from, for a tool that runs
agents for you (`Pointman · @editor`, `release bot`). The page shows it in place of
the harness's name ("Claude Code"), which is still recorded.

## Updates

`npx spacesheep@latest` always runs the newest version. A global install
Expand Down
3 changes: 3 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ async function collectSession(cwd = process.cwd(), env = process.env) {
s.agent = "spacesheep-cli";
}
if (env.AI_AGENT) extra.ai_agent = env.AI_AGENT;
// The name whoever runs the agent gives it (a team's bot, an orchestrator's agent): the page shows
// it in place of the harness's name, which stays in `agent`. Client.agent_name in the schema.
if (env.SPACESHEEP_AGENT_NAME?.trim()) s.agent_name = env.SPACESHEEP_AGENT_NAME.trim().slice(0, 80);

Object.assign(s, await git(cwd));
s.extra = extra;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spacesheep",
"version": "1.43.0",
"version": "1.44.0",
"description": "Publish web pages to spacesheep.dev from a terminal or CI: `npx spacesheep deploy ./dist`",
"bin": {
"spacesheep": "./bin/spacesheep.js"
Expand Down
15 changes: 15 additions & 0 deletions test/agent-name.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use strict";
// A deploy carries the name its runner set (SPACESHEEP_AGENT_NAME), so the page names it that way
// rather than by the harness, which stays recorded. Run: npm test
const { it } = require("node:test");
const assert = require("node:assert");
const os = require("os");
const { collectSession } = require("../lib/session");

it("stamps the runner's name beside the harness", async () => {
const s = await collectSession(os.tmpdir(), { CLAUDECODE: "1", CLAUDE_CODE_SESSION_ID: "abc", SPACESHEEP_AGENT_NAME: " Pointman · @space-builder " });
assert.equal(s.agent, "claude-code");
assert.equal(s.agent_name, "Pointman · @space-builder");
const plain = await collectSession(os.tmpdir(), { CLAUDECODE: "1", MB_RUN_ID: "1" });
assert.equal(plain.agent_name, undefined);
});