Workspace Tool Nodes

Applies to: ChengOS v0.2.0+ | Last verified: 2026-09-25 | Source: crates/cheng-nodes/src/nodes/builtin/tools, crates/cheng-workspace-tools/src

The non-file half of the workspace toolset, and it is deliberately lopsided: tools/workspace_git, tools/workspace_markdown, and tools/workspace_preview expose read-only operations, while anything that can change the machine — an arbitrary shell command, or actually running a test suite — is approval-gated. That asymmetry is the design: inspection should be free, mutation should be a decision. tools/workspace_tests splits along the same line, with a read-only detect operation and a gated run.

Workspace Shell — tools/workspace_shell

Run workspace commands (build/test/lint/diagnostics) with policy checks, bounded output, timeout, and cancellation. Structured command form preferred; shell strings are opt-in and high risk.

Inputs

FieldTypeRequiredDefaultDescription
commandstring—""Executable program to run, e.g. "ls", "cargo", "pnpm", "pytest". This is NOT the tool name.
argsarray<string>—[]Literal arguments for command, e.g. command="ls", args=["-la"]. No shell syntax.
shell_stringstring—nullCompatibility input for simple commands. Shell syntax disabled by default.
cwdstring—nullWorking directory relative to the workspace root. Omit for the root itself.
envobject—{}Extra environment variables (subject to allowlist).
timeout_msinteger—nullWall-clock budget in ms (default 60000, max 600000).
purposestring—nullOne sentence explaining why this command is needed; shown on the approval card.
sandbox_rootstring—nullServer-local sandbox root directory (engine-injected; not for LLM)
allow_shell_stringboolean—falseStatic opt-in for raw shell strings (author-only; default off). Raw shell syntax (pipes, redirection, variables) is disabled unless this is on. Control: switch
command_whiteliststring—""User-configured command whitelist. One program name per line. When non-empty, only listed programs are allowed and shell strings are denied. Control: textarea

Outputs

FieldTypeDescription
successbooleanWhether the command succeeded (exit code 0)
summarystringHuman-readable summary of the command result
command_displaystringDisplay form of the executed command
cwdstringWorking directory used for the command
exit_codeintegerProcess exit code (None when the process did not exit normally)
terminationstringTermination reason: exited, timed_out, cancelled, signalled, or spawn_failed
duration_msintegerWall-clock duration of the command in milliseconds
stdoutstringCapped stdout text (head+tail truncated when over the cap)
stdout_truncatedbooleanTrue when stdout was head+tail truncated due to byte cap
stderrstringCapped stderr text (head+tail truncated when over the cap)
stderr_truncatedbooleanTrue when stderr was head+tail truncated due to byte cap
error_kindstringStable machine code on failure (LOCAL_EXECUTOR_* vocabulary)
terminalbooleanTrue when the error is terminal and must not be retried
errorstringError message when the command failed

Workspace Git — tools/workspace_git

Read-only git inspection (status/diff/log/show/branch) with structured, bounded output. Destructive git operations are not available.

Inputs

FieldTypeRequiredDefaultDescription
operationstring—""Read-only git operation: status, diff, log, show, or branch
cwdstring—nullRepository directory relative to the workspace root. Omit for the root.
pathspecsarray<string>—[]Relative pathspecs to narrow diff/log/status. No absolute paths, no '..'
revisionstring—nullFor show: local revision (HEAD, branch name, commit hash).
max_bytesinteger—nullOutput byte cap (default 262144).
max_countinteger—nullFor log: number of commits (default 20, max 100)
sandbox_rootstring—nullServer-local sandbox root directory (engine-injected; not for LLM)

Outputs

FieldTypeDescription
operationstringGit operation that was executed
successbooleanWhether the operation succeeded
summarystringHuman-readable summary of the operation result
filesanyStructured status entries (changed/staged/untracked files)
commitsanyStructured log entries (hash/author/date/subject)
branchesanyLocal branch names
current_branchstringCurrent branch name (marked in branch list)
stdoutstringRaw capped stdout text (diff/show output)
stdout_truncatedbooleanTrue when stdout was head+tail truncated due to byte cap
stderrstringRaw capped stderr text
error_kindstringStable machine code on failure (LOCAL_EXECUTOR_* vocabulary)
terminalbooleanTrue when the error is terminal and must not be retried
errorstringError message when the operation failed

Workspace Tests — tools/workspace_tests

Detect the project's toolchain and test commands (read-only) and run explicit test commands with structured pass/fail summaries, timeout, and cancellation.

Inputs

FieldTypeRequiredDefaultDescription
operationstring—""detect = read-only project inspection; run = execute an explicit test command (approval-gated)
commandstring—nullTest program for run operation (e.g. "cargo", "pnpm").
argsarray<string>—[]For run: literal command arguments, e.g. ["test", "--no-fail-fast"]
cwdstring—nullDirectory relative to the workspace root (project subdirectory in a monorepo)
timeout_msinteger—nullFor run: wall-clock budget in ms (default 300000, max 600000)
sandbox_rootstring—nullServer-local sandbox root directory (engine-injected; not for LLM)

Outputs

FieldTypeDescription
operationstringTest operation that was executed (detect or run)
successbooleanWhether the operation succeeded
summarystringHuman-readable summary of the test result
detected_projectanyDetected project types, package manager, suggested commands, confidence, and evidence (detect only)
command_displaystringDisplay form of the executed test command (run only)
passedintegerNumber of passed tests (run only)
failedintegerNumber of failed tests (run only)
duration_msintegerWall-clock duration of the test run in milliseconds (run only)
failure_summaryanyFailure hints (name/file/line/message), best effort (run only)
terminationstringTermination reason: exited, timed_out, cancelled, signalled, or spawn_failed (run only)
stdoutstringCapped stdout text (head+tail truncated when over the cap)
stdout_truncatedbooleanTrue when stdout was head+tail truncated due to byte cap
stderrstringCapped stderr text (head+tail truncated when over the cap)
stderr_truncatedbooleanTrue when stderr was head+tail truncated due to byte cap
error_kindstringStable machine code on failure (LOCAL_EXECUTOR_* vocabulary)
terminalbooleanTrue when the error is terminal and must not be retried
errorstringError message when the operation failed

Workspace Markdown — tools/workspace_markdown

Read-only Markdown analysis: heading outlines, structured diagnostics, format suggestions (as edit_file-ready replacements), and local link checks.

Inputs

FieldTypeRequiredDefaultDescription
operationstring—""Read-only markdown analysis: outline, diagnostics, format_suggestions, or link_check_local
pathstring—""Markdown file path relative to the workspace root
sandbox_rootstring—nullServer-local sandbox root directory (engine-injected; not for LLM)

Outputs

FieldTypeDescription
operationstringMarkdown analysis operation that was executed
pathstringMarkdown file path that was analyzed
successbooleanWhether the analysis succeeded
summarystringHuman-readable summary of the analysis result
outlineanyHeading tree entries with levels, 1-indexed lines, and GitHub-style anchors
diagnosticsanyStructured diagnostics: duplicate-heading, heading-hierarchy-jump, empty-link-target, etc.
suggested_editsanyMechanical fixes as edit_file-ready replacements; this tool never writes files itself
error_kindstringStable machine code on failure (LOCAL_EXECUTOR_* vocabulary)
terminalbooleanTrue when the error is terminal and must not be retried
errorstringError message when the operation failed

Workspace Preview — tools/workspace_preview

Render bounded, sanitized previews: Markdown to safe HTML, HTML to a text summary, or artifact metadata. Read-only; persisting output goes through file operations.

Inputs

FieldTypeRequiredDefaultDescription
operationstring—""Preview operation: markdown, html, or artifact_summary
pathstring—nullSource file relative to the workspace root. Takes precedence over content.
contentstring—nullInline source text when no workspace file is involved
max_bytesinteger—nullPreview byte cap (default and max 524288)
sandbox_rootstring—nullServer-local sandbox root directory (engine-injected; not for LLM)

Outputs

FieldTypeDescription
operationstringPreview operation that was executed
successbooleanWhether the preview succeeded
summarystringHuman-readable summary of the preview result
formatstringOutput format: html, text, or metadata
previewstringRendered or derived preview text (bounded)
preview_truncatedbooleanTrue when the preview was head+tail truncated due to byte cap
source_bytesintegerSize of the source content in bytes
source_pathstringSource file path when the preview was from a workspace file
error_kindstringStable machine code on failure (LOCAL_EXECUTOR_* vocabulary)
terminalbooleanTrue when the error is terminal and must not be retried
errorstringError message when the operation failed

Next steps