Response Format
Response Format
Section titled “Response Format”Every String command response is composed of two parts: a system message (meta information) and optional content (actual data).
- Commands that return content:
system message\n---\ncontent - Commands that return only a confirmation: system message alone (no
---) - The daemon prepends
re: [request_id] /cmdbefore the body
Final form example:
re: [003qm] /open hello.mdOpened hello.md---# Hello WorldWelcomeCommand classification
Section titled “Command classification”A. System message + --- + content
Section titled “A. System message + --- + content”Commands that return documents or structured data.
| Command | System message | Content |
|---|---|---|
/open path | Opened path | rendered document |
/open path#block | Opened path#block | rendered block |
/back | Back to path | rendered document |
/refresh | Refreshed path | rendered document |
/edit path (view) | [editing: path] | source with line numbers |
/edit path#block (view) | [editing: path#block] | block source |
/help | String Commands | help text |
/ls [path] | Listing path/ | directory entries |
/nav | Menus | menu list |
/nav name | Menu: name | menu entries |
/nav scaffold | Nav Scaffold | scaffold template |
/info | Session info | info key-value pairs |
/act | Actions | action list |
/act.name --help | Action: name | action schema |
/verify path#block | Verified path#block | block content preview |
/set (list) | Variables | variable list |
| bash (output) | exit: N | cwd: path | command output |
B. System message only (no ---)
Section titled “B. System message only (no ---)”Confirmation and status messages.
| Command | System message |
|---|---|
/open (no args) | usage error |
/write path | Written: path (42 bytes, 3 lines) |
/append path | Appended to: path (now 78 bytes) |
/edit path (with body) | Edited path (2 lines, whole file) |
/edit path#block (with body) | Edited path#block (5 lines) |
/close | Closed: path |
/set {var} = "val" | {var} = "val" |
/undo | Undo: reverted path (N lines) |
/act.name --flags (template response) | action output (template result) |
/act.name --flags (doc response) | category A (rendered doc) |
C. Errors
Section titled “C. Errors”Errors are formatted by the daemon as ERROR(code): message. Commands
return err(message, code) and the daemon wraps them. No ---
separator.
re: [003qm] /open nonexistent.mdERROR(NOT_FOUND): File not found: nonexistent.mdImplementation reference
Section titled “Implementation reference”Return points in commands.ts that produce system message\n---\ncontent:
cmdHelp()—String Commands\n---\n{help text}cmdHelp(bash)—Bash Session\n---\n{help text}cmdLs()—Listing {path}/\n---\n{entries}cmdNav()(list) —Menus\n---\n{menu list}cmdNav(name)—Menu: {name}\n---\n{entries}cmdNav(scaffold)—Nav Scaffold\n---\n{scaffold}cmdInfo()—Session info\n---\n{info lines}cmdAction()(list all) —Actions\n---\n{action list}cmdAction()(—help, action schema) —Action: {id}\n---\n{schema}cmdAction()(no flags, action schema) —Action: {id}\n---\n{schema}cmdAction()(doc response) —Opened {path}\n---\n{rendered doc}cmdEdit()(view whole file) —[editing: {path}]\n---\n{source}cmdEdit()(view block) —[editing: {path}#{block}]\n---\n{source}cmdVerify()—Verified {path}#{block}\n---\n{preview}cmdSet()(list variables) —Variables\n---\n{variable lines}cmdOpen()—Opened {path}\n---\n{rendered doc}cmdBack()—Back to {path}\n---\n{rendered doc}cmdRefresh()—Refreshed {path}\n---\n{rendered doc}