Claude cli

From kortix-ai/CompanyOS · View interactive version

Claude cli is an AI agent skill from the GitHub repository kortix-ai/CompanyOS. Drive Anthropic's Claude Code CLI (`claude -p`) as a non-interactive coding sub-agent from inside Codex. Use when you want to delegate a coding/analysis/refactor task to Claude, get a second opinion / adversarial review from another model, hand off long-context planning, or fan out parallel agents.

How to use this skill

Skill file

Claude Code as a Sub-Agent

Claude Code is Anthropic's terminal coding agent. Its headless mode,

claude -p (a.k.a. --print), makes it a disposable sub-agent: you write the

metaprompt, Claude explores/edits/runs commands on its own, and returns a final

message you capture and verify. You stay the planner; Claude is the implementer —

it's a strong long-context planner, so this is useful for reviews, big-picture

design, and cross-cutting refactors.

Golden rule: Claude's self-report is a claim, not the truth. Capture its

output, then independently verify the artifacts yourself (read the files, re-run

the tests) before treating the task as done.

Verified locally: claude 2.1.167. Confirm install with claude --version.

The core command

claude -p "your metaprompt here" \
  --add-dir <workdir> \
  --permission-mode <default|acceptEdits|plan|bypassPermissions> \
  --output-format json  >/tmp/claude_<rand>.json 2>>/tmp/claude_<rand>.log

long/generated prompts).

session_id + cost/usage), or stream-json (NDJSON events as they arrive).

Use json for clean capture and to grab the session_id for resume.

doesn't pollute your context. Generate <rand> once per run.

Permission modes (pick the least privilege)

prompt, so write actions are effectively blocked → good for read-only

review/analysis.

Powerful; only use when the user has explicitly authorized autonomous edits AND

the working dir is scoped, or in a throwaway dir. When unsure, ask which mode

before granting write access.

Output & session resume

session_id field lets you continue the same conversation.

```bash

claude -p --continue "now also update the tests" # most recent session

claude -p --resume <session-id> "..." # a specific session

```

re-sending all context.

Delegation patterns

your diff or find bugs. Different model, different blind spots.

with its own capture/log file. For concurrent WRITE runs, give each its own

git worktree add dir and point --add-dir there to avoid edit collisions.

The supervision loop (never skip)

  1. Delegate — claude -p ... --output-format json >out 2>>log.
  2. Capture — read the result from out (and log/stream-json for detail).
  3. Verify INDEPENDENTLY — do not trust "tests pass" / "done":
  1. Iterate — if wrong, claude -p --continue "<correction>" and repeat.
  2. Report — state what changed, what you verified, and how. Say plainly when

something failed or was skipped.

Cleanup: remove /tmp/claude_* capture/log files (and any throwaway worktrees)

when done.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.