agentd: Add 'agent' CLI subcommand group with create/list/status

t-740·WorkTask·
·
·
·Omni/Agentd
Parent:t-739·Created2 weeks ago·Updated1 week ago·pipeline runs →

Description

Edit

Add a new agentd agent subcommand group to Omni/Agentd.hs (the CLI module). This is the foundation that other tasks build on.

Commands to implement: 1. agentd agent create <name> --provider <p> --model <m> --cwd <dir> [--thinking <level>] [--extra-args "..."]

  • Writes env file to ~/.config/pi-agents/<name>.env (same format pi-agent uses)
  • Inserts agent record into SQLite (agents table)
  • Uses a typed AgentConfig data type

2. agentd agent list

  • Reads from SQLite + checks systemd unit status for each agent
  • Shows name, status, model, cwd

3. agentd agent status [name]

  • If name given: detailed status (systemd state + DB info + cost)
  • If no name: same as list

New data type in Daemon.hs:

data AgentConfig = AgentConfig
  { acName      :: Text
  , acProvider  :: Text
  , acModel     :: Text
  , acCwd       :: FilePath
  , acThinking  :: Text
  , acExtraArgs :: Maybe Text
  , acExtraEnv  :: Map Text Text
  }

The env file format must match what pi-agent-exec expects:

PI_PROVIDER=anthropic
PI_MODEL=claude-opus-4-20250514
PI_CWD=/home/ben/omni/intent
PI_THINKING=high
PI_EXTRA_ARGS=

Use optparse-applicative for CLI parsing. Add to the existing Command ADT in Omni/Agentd.hs.

Files to modify:

  • Omni/Agentd.hs (CLI parsing + dispatch)
  • Omni/Agentd/Daemon.hs (AgentConfig type, SQLite operations)

Timeline (3)

💬[human]1 week ago

Ava verified: 'agentd agent' subcommand group is live in production agentd CLI. agent create/list/status/start/stop/restart/send/logs/rm/purge all present and functional. Moving to Verified.

🔄[human]Review → Verified1 week ago