Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.19 KB

task.md

File metadata and controls

59 lines (43 loc) · 2.19 KB

Implement claw.md in Go: goclaw/.

Structure as Go API and then a cmd goclaw that exposes that that API via HTTP.

Any program should be able to use the Go API.

Persistence based on SQLite.

Start the (long-lived process): goclaw serve.

goclaw server starts an HTTP server. The primary endpoint is just /do, which reads JSON payload that describes the operation request. Supported operations are all of the the pi-level and claw-level operations described in claw.md.

The /doc endpoint returns a detailed Markdown string that describes everything that this thing can do. It's a user's guide for an agent that wants to use the service.

The serve subcommand has these optional args:

  1. --model MODEL like --model openai/gpt-5:online (and that's the default).
  2. --model-provider PROVIDER like --model-provider openrouter (and that's the default).
  3. --listen PORT defaulting to :8000.

The only tool available to LLMs is bash. Args:

  1. script string to execute
  2. timeout in seconds or Go duration (optional)
  3. stdoutLineEvent: optional object template and bus for publishing a line written to stdout
  4. stderrLineEvent: optional object template and bus to send lines written to stderr
  5. exitEvent: optional template and bus for ending exit code.
  6. timeoutEvent: optional template and bus for sending Boolean indicating if the task timed out.

An object template is just an object that somewhere has a value {payload}. That value is replaced by desired output.

The bash tool result has the following properties:

  1. stdout: string
  2. stderr: string
  3. exitCode: int
  4. timeout: Boolean

bash execution is synchronous to the caller. However, internally stdout, stderr, etc are monitored if those events are specified in the input args. When such an event arrives, it's it published via out. The bus defaults to thebus.

start_session takes bus so that session events can be published. LLM I/O is via openai "responses" with streaming. For now, only tool call streaming events are processed. Each is published via an out call to the session's bus.

Implement the event bus from scratch, but this code should be inspired directly by fyi-ace/.