Skip to content

Improve AI-agent operability with unified docs, machine-readable skill routing, and structured health output#1

Merged
uuhan merged 3 commits into
mainfrom
copilot/review-ai-agent-improvements
Apr 11, 2026
Merged

Improve AI-agent operability with unified docs, machine-readable skill routing, and structured health output#1
uuhan merged 3 commits into
mainfrom
copilot/review-ai-agent-improvements

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

This PR implements an agent-oriented operating layer for Workhorse so Claude Code/Codex-style agents can route tasks deterministically, execute repeatable workflows, and consume stable machine-readable signals.
It adds a single agent entrypoint, a structured skill index, standardized playbooks, and JSON output for a key inspection command.

  • Unified agent entry + routing contract

    • Added AI_AGENT.md as the single agent-facing entry doc.
    • Consolidates task classification → skill mapping → standard commands → success criteria → safety/confirmation policy.
    • Uses portable relative paths to avoid environment-coupled instructions.
  • Machine-readable skills index

    • Added skills/index.json with per-skill metadata:
      • routing keywords
      • preconditions
      • recommended commands
      • risk level (low|medium|high)
      • confirmation requirement
    • Encodes high-risk operation boundaries (--dangerous, service restart/replace, destructive admin ops).
  • Standard task playbooks

    • Added docs/agent-playbooks.md with normalized playbooks for:
      • remote build
      • horsed deploy
      • artifact retrieval
      • health/log troubleshooting
    • Each playbook includes preconditions, ordered steps, fallback path, and acceptance signals.
  • Agent-friendly CLI structured output

    • Extended cargo work health with --json.
    • Added stable JSON fields for automation parsing (status, protocol, ulimit_nofile, plus v2 metadata like version/commit/os/arch/family/default_shell).
    • Preserved existing human-readable behavior when --json is not used.
  • CLI options hardening for agent invocation

    • Renamed positional overrides in ping/health options (remotehost) to avoid argument-name collisions with flattened HorseOptions.
  • Regression + consistency guardrails in repo/CI

    • Added scripts/check-agent-docs.py for structural/content consistency across agent docs and index.
    • Added scripts/agent-regression-cases.json + scripts/check-agent-regression.py (12 cases) to validate routing metadata and CLI surface assumptions.
    • Wired checks into CI via a new agent-validation job and exposed a local just agent-check target.
    • Updated README.md, README.en.md, and AGENTS.md to surface the new agent entry/index and health --json.
# New machine-readable health output for agents
cargo work health --json
{
  "status": "ok",
  "protocol": "v2",
  "version": "0.3.0",
  "commit": "<sha>",
  "os": "linux",
  "arch": "x86_64",
  "family": "unix",
  "default_shell": "/bin/bash",
  "ulimit_nofile": 65535
}

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 762fc47ea8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread justfile
Comment on lines +42 to +44
agent-check:
@python3 scripts/check-agent-docs.py
@python3 scripts/check-agent-regression.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Build cargo-work before running agent regression checks

agent-check runs check-agent-regression.py directly, but that script exits unless target/debug/cargo-work already exists. On a clean checkout, just agent-check will fail before doing any regression validation, so the new local guardrail command is not runnable as introduced. Add a build step (or make this recipe depend on one) so the command works end-to-end.

Useful? React with 👍 / 👎.

Comment on lines +40 to +42
binary = ROOT / "target" / "debug" / "cargo-work"
if not binary.exists():
fail("target/debug/cargo-work does not exist, run cargo build --bin cargo-work first")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect Windows cargo-work executable in regression script

The regression script hardcodes target/debug/cargo-work, but on Windows cargo build --bin cargo-work outputs cargo-work.exe. This makes the check fail with “does not exist” even when the binary was built successfully, breaking portability for Windows contributors and any future Windows CI usage of this script.

Useful? React with 👍 / 👎.

@uuhan uuhan merged commit c396ae3 into main Apr 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants