Make tkn CLI agent-friendly for AI/LLM consumption
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 461
- Forks
- 277
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 95
Description
Summary
AI agents are increasingly using CLIs as their primary interface to external systems. The tkn CLI should be optimized for both human and agent consumption, following principles from You Need to Rewrite Your CLI for AI Agents.
Motivation
AI coding agents (Copilot, Claude Code, Cursor, etc.) use CLIs directly. They need:
- Deterministic, machine-readable output — not tables designed for human eyes
- Self-describing conventions — agents need to know how to use the CLI efficiently
- Structured input — agents generate JSON more reliably than bespoke flag combinations
- Reliable exit codes — agents depend on exit codes, not output parsing
Currently, tkn has inconsistent --output support, no non-TTY auto-detection, undocumented exit codes, and no structured JSON input path.
Sub-issues
Ordered by priority / effort-to-value ratio:
Phase 1 — Foundations
- #2856 — Ship a CONTEXT.md for AI agents (zero code, highest ROI)
- #2850 — Consistent
--output jsonon all commands + non-TTY auto-detection - #2855 — Consistent, documented exit codes
Phase 2 — Enhanced agent support
- #2851 — Structured JSON input for start commands
- #2853 — Field selection (
--fields) — client-side filtering to reduce agent token consumption - #2854 — Agent-friendly logs output (structured NDJSON logs)
Phase 3 — Advanced capabilities
- #2859 — Adversarial input validation for agent-generated commands
- #2852 — Runtime schema introspection for agent discovery
- #2860 — Dry-run and validation for mutating operations
- #2861 — MCP surface for direct agent integration
References
- You Need to Rewrite Your CLI for AI Agents — Justin Poehnelt (Google)
- The MCP Abstraction Tax — followup on protocol layers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by reviewing the linked Phase 1–3 sub-issues and choose one narrowly scoped task; done means implementing and validating that selected sub-issue rather than the entire agent-friendly CLI initiative.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100