Overview
Moss is designed to be agent-operable — every action available in the dashboard can be performed via CLI or API. This makes Moss a natural fit for AI coding agents that can run shell commands or make HTTP requests.How it works
AI agents interact with Moss through:- CLI commands — Agents execute
mosscommands in a terminal, using--jsonfor structured output - API calls — Agents make HTTP requests to the REST API with an
X-API-Keyheader - Exit codes — Agents can branch on success/failure using standardized exit codes
Compatible agents
| Agent | Interface | Setup |
|---|---|---|
| Claude Code | CLI | Add instructions to CLAUDE.md |
| Cursor | CLI or API | Configure in .cursorrules |
| Codex | CLI or API | Add to system prompt |
| Custom agents | API | Use any HTTP client |
Setting up Claude Code
Add the following to your project’sCLAUDE.md:
Structured output with --json
Every CLI command supports the --json flag, which outputs data in a consistent JSON envelope:
Exit codes for control flow
Agents can use exit codes to handle errors programmatically:| Code | Meaning | Agent action |
|---|---|---|
0 | Success | Proceed |
1 | General error | Retry or report |
2 | Validation error | Fix input and retry |
3 | Authentication error | Re-authenticate |
4 | Not found | Handle missing resource |
5 | Rate limited | Back off and retry |
Example agent flows
Daily CRM review
Post-meeting logging
Pipeline management
Best practices
- Always use
--json— Table output is for humans; JSON output is for agents - Check exit codes — Don’t assume success; handle errors gracefully
- Use
--request-id— Pass a unique request ID for tracing and debugging - Use
--idempotency-key— Prevent duplicate creates when retrying - Scope API keys — Create a dedicated API key with minimum required scopes for each agent