Skip to content

Make tkn CLI agent-friendly for AI/LLM consumption #2849

@vdemeester

Description

@vdemeester

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

  1. Ship a CONTEXT.md for AI agent consumption #2856Ship a CONTEXT.md for AI agents (zero code, highest ROI)
  2. Add consistent --output json support to all tkn commands #2850Consistent --output json on all commands + non-TTY auto-detection
  3. Define consistent exit codes for all tkn commands #2855Consistent, documented exit codes

Phase 2 — Enhanced agent support

  1. Support structured JSON input for start commands #2851Structured JSON input for start commands
  2. Add field selection and NDJSON streaming for list commands #2853Field selection (--fields) — client-side filtering to reduce agent token consumption
  3. Make pipelinerun/taskrun logs agent-friendly #2854Agent-friendly logs output (structured NDJSON logs)

Phase 3 — Advanced capabilities

  1. Adversarial input validation for agent-generated commands #2859Adversarial input validation for agent-generated commands
  2. Add schema introspection command (tkn schema) #2852Runtime schema introspection for agent discovery
  3. Dry-run and validation for mutating operations #2860Dry-run and validation for mutating operations
  4. MCP surface for tkn CLI #2861MCP surface for direct agent integration

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions