-
Notifications
You must be signed in to change notification settings - Fork 1
Improve AI-agent operability with unified docs, machine-readable skill routing, and structured health output #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # AI Agent Entry (Claude Code / Codex) | ||
|
|
||
| This file is the single entry point for AI agents operating on this repository. | ||
|
|
||
| ## Primary Routing | ||
|
|
||
| 1. Read `skills/index.json`. | ||
| 2. Classify task into one domain: | ||
| - `cargo-work` client workflow | ||
| - `horsed` server workflow | ||
| - cross-boundary workflow | ||
| 3. Dispatch to the matching skill in `skills/`. | ||
| 4. Use standard playbooks in `docs/agent-playbooks.md`. | ||
|
|
||
| ## Task Classification -> Skill | ||
|
|
||
| - General Workhorse triage -> `skills/workhorse/SKILL.md` | ||
| - `cargo work` remote build/test/check/clippy/run/just -> `skills/workhorse-remote-build/SKILL.md` | ||
| - `cargo work ssh` / raw remote commands / forwarding / proxy -> `skills/workhorse-remote-access/SKILL.md` | ||
| - `get/scp/push/pull/ping/health/logs/job` -> `skills/workhorse-artifact-sync/SKILL.md` | ||
| - `horsed` bootstrap / first user / setup mode -> `skills/workhorse-horsed-setup/SKILL.md` | ||
| - `horsed` ops / service manager / troubleshooting -> `skills/workhorse-horsed-ops/SKILL.md` | ||
| - `horsed` code, migration, protocol, tests -> `skills/workhorse-horsed-dev/SKILL.md` | ||
|
|
||
| ## Standard Commands | ||
|
|
||
| - Build binaries: `cargo build --bin cargo-work --bin horsed` | ||
| - Workspace tests: `cargo test --verbose` | ||
| - Health (human): `cargo work health` | ||
| - Health (machine): `cargo work health --json` | ||
| - Logs: `cargo work logs` / `cargo work logs -f` | ||
| - Jobs: `cargo work job list` / `cargo work job attach <job_id> -f` | ||
|
|
||
| ## Success Criteria | ||
|
|
||
| - Build/test tasks: command exits with code `0`. | ||
| - Remote build tasks: expected artifact exists on remote and can be fetched with `cargo work get`. | ||
| - Health check (JSON mode): JSON parse succeeds and includes `status`, `protocol`, `ulimit_nofile` fields. | ||
| - Ops tasks: service state and logs match expected behavior. | ||
|
|
||
| ## Safety Boundaries | ||
|
|
||
| - Low risk: read-only inspection (`ping`, `health`, `logs`, `job list`). | ||
| - Medium risk: remote command execution, file sync, interactive shell, forwarding/proxy. | ||
| - High risk: `horsed --dangerous`, service restart/replace, user/key admin mutation. | ||
|
|
||
| ## Confirmation Policy | ||
|
|
||
| Require explicit confirmation from the user before high-risk actions: | ||
|
|
||
| - enabling `--dangerous` | ||
| - restarting/stopping production `horsed` | ||
| - overwriting binaries/state in remote deploy paths | ||
| - destructive user/key/admin operations | ||
|
|
||
| ## Related Assets | ||
|
|
||
| - Agent skill index: `skills/index.json` | ||
| - Agent playbooks: `docs/agent-playbooks.md` | ||
| - Human-oriented guidance: `README.md`, `README.en.md`, `AGENTS.md` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Agent Playbooks | ||
|
|
||
| ## 1) Remote Build Playbook | ||
|
|
||
| ### Preconditions | ||
| - Target server is resolvable via `--repo`, `--repo-name`, or git remote `horsed`. | ||
| - SSH key is available (`--ssh-key` or default key path). | ||
|
|
||
| ### Steps | ||
| 1. `cargo work ping --count 1` | ||
| 2. `cargo work build --release` (or `cargo work test` for test tasks) | ||
| 3. If needed, attach output: `cargo work job list` then `cargo work job attach <job_id> -f` | ||
|
|
||
| ### Fallback | ||
| - If repo/host resolve fails: provide `--repo ssh://git@HOST:2222/ns/repo.git`. | ||
| - If command hangs: retry with `RUST_LOG=info WH_DEBUG=1` to collect staged traces. | ||
|
|
||
| ### Acceptance Signals | ||
| - Exit code is `0`. | ||
| - Output contains successful completion from Cargo. | ||
|
|
||
| ## 2) Horsed Deploy Playbook | ||
|
|
||
| ### Preconditions | ||
| - Remote branch is up to date. | ||
| - Explicit confirmation if service restart is required. | ||
|
|
||
| ### Steps (Linux/macOS) | ||
| 1. `just install-work` | ||
| 2. `HORSED_SHELL=/bin/bash cargo work just install-horsed` | ||
| 3. `HORSED_SHELL=/bin/bash cargo work -- systemctl --user restart horsed` | ||
| 4. `cargo work health --json` | ||
|
|
||
| ### Steps (Windows) | ||
| 1. `just install-work` | ||
| 2. `HORSED_SHELL=powershell.exe cargo work just deploy-horsed` | ||
| 3. `cargo work health --json` | ||
|
|
||
| ### Fallback | ||
| - If `nu` is missing on server, use `/bin/bash`, `/bin/sh`, or `powershell.exe`. | ||
| - If post-restart health fails, inspect: `cargo work logs -f`. | ||
|
|
||
| ### Acceptance Signals | ||
| - `health --json` returns parseable JSON with `status: "ok"`. | ||
|
|
||
| ## 3) Artifact Retrieval Playbook | ||
|
|
||
| ### Preconditions | ||
| - Remote build already completed. | ||
|
|
||
| ### Steps | ||
| 1. Retrieve a file: `cargo work get target/release/<artifact> -f` | ||
| 2. Retrieve a directory: `cargo work get target -f` | ||
| 3. Alternative stream copy: `cargo work scp <remote_file> <local_file>` | ||
|
|
||
| ### Fallback | ||
| - If local file exists and retrieval fails, use `-f` or `--outfile`. | ||
|
|
||
| ### Acceptance Signals | ||
| - Retrieved path exists locally. | ||
| - Artifact checksum/size matches expected output (when available). | ||
|
|
||
| ## 4) Health/Logs Troubleshooting Playbook | ||
|
|
||
| ### Preconditions | ||
| - Server is reachable. | ||
|
|
||
| ### Steps | ||
| 1. `cargo work ping --count 3` | ||
| 2. `cargo work health --json` | ||
| 3. `cargo work logs` (or `cargo work logs -f`) | ||
| 4. `cargo work job list` | ||
|
|
||
| ### Fallback | ||
| - If health output seems empty in normal mode: `RUST_LOG=info cargo work health` | ||
| - For deeper traces: `RUST_LOG=info WH_DEBUG=1 cargo work health` | ||
|
|
||
| ### Acceptance Signals | ||
| - JSON includes stable fields: `status`, `protocol`, `ulimit_nofile`. | ||
| - Logs show expected service state transitions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent-checkrunscheck-agent-regression.pydirectly, but that script exits unlesstarget/debug/cargo-workalready exists. On a clean checkout,just agent-checkwill 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 👍 / 👎.