← All procedures

claude.start

Start one turn of the Claude Code CLI as a detached process that writes to a file

CLI
Package
@procedures/claude-cli · README
Path
["claude","start"]
CLI
mark claude start --prompt <string>
As data
{"$proc":["claude","start"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/claude-cli/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["claude","start"], { prompt: "<prompt>" });
console.log(JSON.stringify(result));

From the command line

$ mark claude start --prompt <string>

As data, in a program

{ "$proc": ["claude", "start"], "input": { "prompt": "<prompt>" } }

Input

FieldTypeRequiredDefaultDescription
promptstringyesThe prompt of the turn
cwdstringnoThe working folder of the turn
argsstring[]noMore arguments, for example ["--resume", "<session>"] or ["--model", "<name>"]
outputFilestringnoThe file that gets the output (default: a file in a new temporary folder)
promptFilestringnoThe file that holds the prompt (default: <outputFile>.prompt.txt)
executablestringnoThe claude program (default: CLAUDE_BIN, then a search)
executableArgsstring[]noThe arguments before the flags, for example the path of cli.js
envobjectnoEnvironment variables to add to the environment of the host

Output

FieldTypeRequiredDefaultDescription
pidnumberyesThe process id of the turn
outputFilestringyesThe absolute path of the output file
promptFilestringyesThe absolute path of the prompt file
offsetnumberyesThe byte offset where the output of this turn starts
commandstringyesThe program
argsstring[]yesThe arguments of the program
startedAtstringyesThe start time (ISO 8601)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "prompt": {
        "type": "string",
        "minLength": 1,
        "description": "The prompt of the turn"
      },
      "cwd": {
        "description": "The working folder of the turn",
        "type": "string",
        "minLength": 1
      },
      "args": {
        "description": "More arguments, for example [\"--resume\", \"<session>\"] or [\"--model\", \"<name>\"]",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "outputFile": {
        "description": "The file that gets the output (default: a file in a new temporary folder)",
        "type": "string",
        "minLength": 1
      },
      "promptFile": {
        "description": "The file that holds the prompt (default: <outputFile>.prompt.txt)",
        "type": "string",
        "minLength": 1
      },
      "executable": {
        "description": "The claude program (default: CLAUDE_BIN, then a search)",
        "type": "string",
        "minLength": 1
      },
      "executableArgs": {
        "description": "The arguments before the flags, for example the path of cli.js",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "env": {
        "description": "Environment variables to add to the environment of the host",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "required": [
      "prompt"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "pid": {
        "type": "number",
        "description": "The process id of the turn"
      },
      "outputFile": {
        "type": "string",
        "description": "The absolute path of the output file"
      },
      "promptFile": {
        "type": "string",
        "description": "The absolute path of the prompt file"
      },
      "offset": {
        "type": "number",
        "description": "The byte offset where the output of this turn starts"
      },
      "command": {
        "type": "string",
        "description": "The program"
      },
      "args": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The arguments of the program"
      },
      "startedAt": {
        "type": "string",
        "description": "The start time (ISO 8601)"
      }
    },
    "required": [
      "pid",
      "outputFile",
      "promptFile",
      "offset",
      "command",
      "args",
      "startedAt"
    ],
    "additionalProperties": false
  }
}