Skip to content

aitools

aitools is a command-line tool for AI agents. Built-in commands handle files, text, structured documents, Markdown, host inspection, HTTP requests, and DNS lookups. The run command invokes installed programs such as awk, sed, and grep. aitools has no color, prompts, or shell completion.

  • One JSON object per call. Success goes to standard output, errors go to standard error. Exit code 0 marks success; 2 marks a precondition failure, 3 a partial result, and 1 another error.
  • Bounded reads. Every read has a limit. A cut result says so and carries the command that reads the next part.
  • Guarded writes. A guarded edit names the text it replaces or the hash and count it expects, and writes nothing when the file differs.
  • Journaled writes with recovery and undo. On a later run, recovery finishes or discards an interrupted write when safe. If a checkpoint cannot be reopened safely, it retains the intent for operator recovery. Use aitools undo <op_id> to revert a completed operation.
  • Transactions. Writes from several calls can be staged, inspected, and committed as one operation.
  • Secret masking. Known secret formats are replaced with [REDACTED_SECRET] in JSON output.
  • External programs. aitools run -- PROGRAM ARG... captures output and reports the child's exit status. External writes are not guarded or journaled; raw output saved with --stdout-to is not secret-masked.
  • Repairs. Every error includes at least one suggested aitools command. Review it before use; some repairs name only a command, without the arguments needed for a complete invocation. Calling a shell command name such as cat returns a suggested aitools replacement.

aitools is written in Common Lisp for SBCL and built with Nix.

Where to go next

These pages are the specification of aitools's behavior. The session migration guide identifies operations that remain external to aitools.