Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

help: /help organized by theme for humans + the peer-hearing model in prose

Rach Pradhana4c6c186fd0f
diff --git a/src/command_catalog.zig b/src/command_catalog.zig
index 3969f2ab..a0bd1780 100644
--- a/src/command_catalog.zig
+++ b/src/command_catalog.zig
@@ -30,7 +30,7 @@ pub const commands = [_]Item{
.{ .name = "/loop", .usage = "/loop [30m] <prompt>", .desc = "the same autonomous run as /goal, without adopting a standing objective" },
.{ .name = "/review", .usage = "/review <target or instructions>", .desc = "run one isolated read-only review pass; no edits, delegation, or workflows" },
.{ .name = "/never", .usage = "/never [<text>|rm <id>]", .desc = "standing constraints that ride every subagent brief and survive compaction; bare lists them, rm <id> retires one (alias /constraint)" },
- .{ .name = "/tell", .usage = "/tell <session|all> <text>", .desc = "post to this folder's shared graff channel — every live session hears it; /sessions lists who's around" },
+ .{ .name = "/tell", .usage = "/tell <session|all> <text>", .desc = "message a running graff: <session> is a DM (only it hears, any folder); all broadcasts to every graff on this device; /sessions lists who's around" },
.{ .name = "/peek", .usage = "/peek <session>", .desc = "see what a live co-resident session is doing right now (its transcript tail)" },
.{ .name = "/routes", .usage = "/routes [<set>|add <set> <frontier|mid|small> <provider/model>]", .desc = "your own priced model lanes across providers — view the set and which seat wins each lane now" },
.{ .name = "/plan", .desc = "toggle plan mode: read-only explore + propose; writes/edits denied" },
diff --git a/src/commands_misc.zig b/src/commands_misc.zig
index 24c19057..826702c1 100644
--- a/src/commands_misc.zig
+++ b/src/commands_misc.zig
@@ -573,19 +573,6 @@ pub fn handleRest(line: []const u8, out: *Io.Writer) !void {
try out.flush();
return;
}
- try out.writeAll("commands (bare / opens the filterable menu):\n");
- for (command_catalog.commands) |command| {
- const usage = if (command.usage.len > 0) command.usage else command.name;
- try out.print(" {s:<32} {s}\n", .{ usage, command.desc });
- }
- try out.writeAll(
- \\ exit | /exit | /quit quit (also ctrl-d or ctrl-c on an empty line)
- \\
- \\esc during a response interrupts the turn; streamed output remains in history.
- \\"always allow" answers persist to .harness/settings.json in the cwd.
- \\launch flags: --model <name> · --yolo · -p "prompt" · --json · --help · --version
- \\subcommands: graff login [codex] · graff key set <provider> <key> · graff --schema
- \\
- );
+ try @import("help.zig").render(out);
try out.flush();
}
diff --git a/src/help.zig b/src/help.zig
new file mode 100644
index 00000000..c8f3533e
--- /dev/null
+++ b/src/help.zig
@@ -0,0 +1,90 @@
+//! /help, organized for humans: the flat command catalog grouped into themes
+//! with plain-language headers and a short prose explainer where a one-line
+//! desc cannot carry the semantics (today: who hears what on the #469 peer
+//! channel). Command names/usages/descs still come from command_catalog — this
+//! file only chooses the grouping, and its test fails the suite the day a new
+//! command ships without a section, so help can never quietly drift.
+
+const std = @import("std");
+const Io = std.Io;
+const command_catalog = @import("command_catalog.zig");
+
+pub const Section = struct {
+ title: []const u8,
+ names: []const []const u8,
+ /// Prose printed under the section's commands (leading spaces included).
+ blurb: []const u8 = "",
+};
+
+const peers_blurb =
+ \\ how hearing works: graff sessions in the SAME folder hear each other's
+ \\ coordination posts automatically — announce what you're restructuring,
+ \\ ask the others to hold off a file, split the work. Nothing crosses
+ \\ folders unless it names your session or comes from you: /tell to one
+ \\ session is a DM (only it hears, any folder), /tell all is YOUR
+ \\ broadcast to every graff on this device. Other folders' chatter
+ \\ collapses into a one-line "skipped" marker, never a wall of text.
+ \\
+;
+
+pub const sections = [_]Section{
+ .{ .title = "getting around", .names = &.{ "/new", "/clear", "/resume", "/save", "/sessions", "/rename", "/rewind" } },
+ .{ .title = "the model", .names = &.{ "/model", "/models", "/effort", "/reasoning", "/fast", "/thinking", "/keepcontext", "/fallback", "/routes" } },
+ .{ .title = "working autonomously", .names = &.{ "/goal", "/loop", "/review", "/plan", "/todo", "/jobs", "/ultracode", "/strict", "/yolo", "/never" } },
+ .{ .title = "talking to other graffs", .names = &.{ "/tell", "/peek" }, .blurb = peers_blurb },
+ .{ .title = "your setup", .names = &.{ "/login", "/key", "/cost", "/privacy", "/mcp", "/skills", "/agents", "/hooks", "/tools", "/fleet" } },
+ .{ .title = "context & history", .names = &.{ "/compact", "/btw", "/doctor", "/trace", "/trajectory" } },
+ .{ .title = "shell & images", .names = &.{ "/bash", "/image", "/images", "/paste" } },
+ .{ .title = "look & feel", .names = &.{ "/theme", "/animation", "/title" } },
+ .{ .title = "this list", .names = &.{"/help"} },
+};
+
+fn find(name: []const u8) ?command_catalog.Item {
+ for (command_catalog.commands) |cmd| if (std.mem.eql(u8, cmd.name, name)) return cmd;
+ return null;
+}
+
+pub fn render(out: *Io.Writer) !void {
+ try out.writeAll("graff — type naturally; bare / opens the filterable menu. commands by theme:\n");
+ for (sections) |sec| {
+ try out.print("\n {s}\n", .{sec.title});
+ for (sec.names) |name| {
+ const cmd = find(name) orelse continue;
+ const usage = if (cmd.usage.len > 0) cmd.usage else cmd.name;
+ try out.print(" {s:<28} {s}\n", .{ usage, cmd.desc });
+ }
+ if (sec.blurb.len > 0) try out.writeAll(sec.blurb);
+ }
+ try out.writeAll(
+ \\
+ \\ exit | /exit | /quit quit (also ctrl-d or ctrl-c on an empty line)
+ \\
+ \\esc during a response interrupts the turn; streamed output remains in history.
+ \\"always allow" answers persist to .harness/settings.json in the cwd.
+ \\launch flags: --model <name> · --yolo · -p "prompt" · --json · --help · --version
+ \\subcommands: graff login [codex] · graff key set <provider> <key> · graff --schema
+ \\
+ );
+}
+
+test "every catalog command appears in exactly one /help section" {
+ for (command_catalog.commands) |cmd| {
+ var count: usize = 0;
+ for (sections) |sec| {
+ for (sec.names) |name| {
+ if (std.mem.eql(u8, name, cmd.name)) count += 1;
+ }
+ }
+ try std.testing.expectEqual(@as(usize, 1), count);
+ }
+}
+
+test "render prints every section title, the peers blurb, and the exit footer" {
+ var aw: Io.Writer.Allocating = .init(std.testing.allocator);
+ defer aw.deinit();
+ try render(&aw.writer);
+ const text = aw.writer.buffered();
+ for (sections) |sec| try std.testing.expect(std.mem.indexOf(u8, text, sec.title) != null);
+ try std.testing.expect(std.mem.indexOf(u8, text, "how hearing works") != null);
+ try std.testing.expect(std.mem.indexOf(u8, text, "exit | /exit | /quit") != null);
+}
diff --git a/src/test_hooks.zig b/src/test_hooks.zig
index af1ff289..81461f41 100644
--- a/src/test_hooks.zig
+++ b/src/test_hooks.zig
@@ -70,6 +70,8 @@ const scoring_slot_test = @import("scoring_slot_test.zig");
// #273: session.zig's own tests, moved off it for the same reason.
const session_tests = @import("session_tests.zig");
+// /help's sectioned render + the catalog-coverage guard.
+const help = @import("help.zig");
// #441: and session_transcript.zig's, moved off it for the same reason again.
// The module itself is reached from session.queueSave, but this FILE is not, so
@@ -218,6 +220,7 @@ test {
_ = serve_create;
_ = scoring_slot_test;
_ = session_tests;
+ _ = help;
_ = session_transcript_tests;
_ = session_settings_tests;
_ = commands_session_test;