Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
d111802
docs: add versioned agent-client capability matrix and policy controls
roodboi Oct 12, 2026
58c485a
fix(mcp): harden run argv and tool input contract
roodboi Oct 12, 2026
c6c0db3
fix(env): harden legacy env key files and AES-GCM envelope parsing
roodboi Oct 12, 2026
de862d7
Merge remote-tracking branch 'origin/next' into w14-rework
roodboi Oct 12, 2026
dc88c6b
Merge remote-tracking branch 'origin/next' into w06-rework
roodboi Oct 12, 2026
ffeecce
fix(agents): generate capability matrix doc and parse all guidance co…
roodboi Oct 12, 2026
56bac3a
fix(mcp): make typed refusals value-free and keep unknown-tool in-band
roodboi Oct 12, 2026
12e80af
chore: merge origin/next into wf/w15-w5-6
roodboi Oct 12, 2026
cd76b26
test(env): pin AES-GCM IV, size and tag-length guards with discrimina…
roodboi Oct 12, 2026
bcf88ec
fix(init): stop writing repo-local agent files by default
roodboi Oct 12, 2026
c005262
fix(env): resolve --env base and default the same way on every command
roodboi Oct 12, 2026
6136946
fix(agents): count corrupted and unreadable integrations as drift
roodboi Oct 12, 2026
9854d1b
test(env): pin the console logger backend for CLI refusal tests
roodboi Oct 12, 2026
6e1ff63
test(mcp): assert closed ambiguous_project refusal in project-name suite
roodboi Oct 12, 2026
1f8b51e
chore(x01): temporary witness cost trace for hosted measurement
roodboi Oct 12, 2026
0911e6d
perf(storage): coalesce witness helper work per native command
roodboi Oct 12, 2026
eb9a678
chore(x01): revert temporary witness cost trace
roodboi Oct 12, 2026
7b2ccfc
test(e2e): restore the networks scenario budget after witness coalescing
roodboi Oct 12, 2026
fa7741c
Merge remote-tracking branch 'origin/next' into wf/x03-witness-probes
roodboi Oct 12, 2026
37f093a
perf(storage): make witness engine and executable fences cheaper
roodboi Oct 12, 2026
6a4e118
chore(x03): temporary witness probe trace for hosted measurement
roodboi Oct 12, 2026
2b11ed3
fix(storage): keep closed probe cancellation for direct engine-ID fences
roodboi Oct 12, 2026
a777bc4
test(storage): pin witness fence counts and refusal controls
roodboi Oct 12, 2026
994ddb8
chore(x03): revert temporary witness probe trace
roodboi Oct 12, 2026
3edbd54
feat(agents): package offline skill references and the HACK-P pattern…
roodboi Oct 12, 2026
726cc27
test(e2e): add agent-surface-freeze negative control for guidance writes
roodboi Oct 12, 2026
9b971fa
ci: add gated Bun crash experiment and read-only crash census
roodboi Oct 12, 2026
1342871
perf(storage): read engine identity directly for docker context selec…
roodboi Oct 12, 2026
c2ecf9c
chore(x04): temporary witness probe trace for hosted measurement
roodboi Oct 12, 2026
5cf9f0f
chore(x04): revert temporary witness probe trace
roodboi Oct 12, 2026
ebe0539
test(agents): cover reference generation and reference-style and HTML…
roodboi Oct 12, 2026
6b54980
test: keep the Bun crash loop tests free of real crash reports
roodboi Oct 12, 2026
7a05b84
Merge branch 'next' into wf/w15-w5-6
roodboi Oct 12, 2026
c00468c
Merge branch 'next' into wf/w06-w5-3
roodboi Oct 12, 2026
e9b1252
Merge branch 'next' into wf/w13-w5b-2
roodboi Oct 12, 2026
af786b5
Merge branch 'next' into wf/w10-w5b-0
roodboi Oct 12, 2026
9db4dba
Merge branch 'next' into wf/w14-w5-5
roodboi Oct 12, 2026
5a731cc
Merge remote-tracking branch 'origin/wf/w06-w5-3' into train/queue-pr…
roodboi Oct 12, 2026
38d9d7f
Merge remote-tracking branch 'origin/wf/w14-w5-5' into train/queue-pr…
roodboi Oct 12, 2026
d50e935
Merge remote-tracking branch 'origin/wf/w15-w5-6' into train/queue-pr…
roodboi Oct 12, 2026
8bab674
Merge remote-tracking branch 'origin/wf/w10-w5b-0' into train/queue-p…
roodboi Oct 12, 2026
26958c9
Merge remote-tracking branch 'origin/wf/w13-w5b-2' into train/queue-p…
roodboi Oct 12, 2026
07a1834
Merge remote-tracking branch 'origin/wf/w07-w6-3' into train/queue-pr…
roodboi Oct 12, 2026
a92e3ab
Merge remote-tracking branch 'origin/wf/w02-w6-1' into train/queue-pr…
roodboi Oct 12, 2026
3e261d5
Merge remote-tracking branch 'origin/wf/w05-w6-2' into train/queue-pr…
roodboi Oct 12, 2026
6b22e00
test(patterns): add validated HACK-P01 and HACK-P02 example fixtures
roodboi Oct 12, 2026
b07121f
feat(exec): warn value-free when a running service's env changed sinc…
roodboi Oct 12, 2026
9f20366
fix(env): write .hack/.env and the encrypted store atomically with 0600
roodboi Oct 12, 2026
e2f063b
feat(agents): add focused hack-branches, hack-env and hack-diagnose p…
roodboi Oct 12, 2026
42e7b3b
fix(mcp): separate log cutoffs from backend failures
roodboi Oct 12, 2026
e2c41a9
fix(mcp): align budget docs with log cutoffs and keep byte-cut failures
roodboi Oct 12, 2026
cea44f8
feat(mcp): add exec, doctor, env explain/keys and instances tools
roodboi Oct 12, 2026
85c67b0
fix(ci): allowlist the synthetic MCP inspect-tool canary for gitleaks
roodboi Oct 12, 2026
10b6d73
fix(agents): point the env matrix bullet at the offline env guide
roodboi Oct 12, 2026
77da332
Merge remote-tracking branch 'origin/wf/w13-w5b-2' into train/queue-p…
roodboi Oct 12, 2026
4e3acee
test(exec): cover failed targeted restart env digest handling
roodboi Oct 12, 2026
cb665d5
fix(env): scope the env-file symlink refusal doc to write paths
roodboi Oct 12, 2026
3a6f73c
docs(mcp): clarify which instances hack.project.instances lists
roodboi Oct 12, 2026
c2b41ff
chore: merge train/queue-preview into wf/y3-envfile-b6
roodboi Oct 12, 2026
d9a5627
chore: merge train/queue-preview into wf/y1-logs-b6
roodboi Oct 12, 2026
8031f28
chore: merge train/queue-preview into wf/w08-b6
roodboi Oct 12, 2026
09b4e83
Merge remote-tracking branch 'origin/train/queue-preview' into wf/y4-…
roodboi Oct 12, 2026
5afaf19
Merge remote-tracking branch 'origin/train/queue-preview' into wf/y5-…
roodboi Oct 12, 2026
36cd272
test(e2e): keep Hack diagnostics out of exec-stale-env probe output
roodboi Oct 12, 2026
b9ae28c
chore: merge wf/y1-logs-b6 into wf/y2-mcptools-b6
roodboi Oct 12, 2026
919de8b
test(e2e): reproduce dependency config-hash drift for hack run/exec
roodboi Oct 12, 2026
de55236
feat(env): accept secret values on stdin with --value-stdin
roodboi Oct 12, 2026
5078855
feat(doctor): add value-free env key strength diagnostic
roodboi Oct 12, 2026
5f8cb79
fix(logger): pass messages to gum after an end-of-options marker
roodboi Oct 12, 2026
378f75f
fix(env): refuse invalid env key arguments without echoing them
roodboi Oct 12, 2026
4acac81
fix(env): refuse env scope arguments without echoing them
roodboi Oct 12, 2026
b1bc6db
fix(env): refuse value-bearing --env, --project and --target without …
roodboi Oct 12, 2026
0a26c64
Merge branch 'next' into wf/c5-confighash-b7
roodboi Oct 12, 2026
07413d0
Merge branch 'next' into wf/c4-keydiag-b7
roodboi Oct 12, 2026
6a043c0
Merge branch 'next' into wf/c6-gum-dash-b7
roodboi Oct 12, 2026
13165f9
Merge branch 'next' into wf/y4-patterns-b6
roodboi Oct 12, 2026
92c2ee1
Merge branch 'next' into wf/y5-staleenv-b6
roodboi Oct 12, 2026
4243d60
Merge branch 'next' into wf/y3-envfile-b6
roodboi Oct 12, 2026
7425da0
Merge branch 'next' into wf/w08-b6
roodboi Oct 12, 2026
c044445
Merge branch 'next' into wf/y1-logs-b6
roodboi Oct 12, 2026
6dadbe5
Merge branch 'wf/y1-logs-b6' into wf/y2-mcptools-b6
roodboi Oct 12, 2026
ed7d2f4
Merge branch 'next' into wf/c1-stdin-b7
roodboi Oct 12, 2026
989fcea
Merge branch 'wf/c6-gum-dash-b7' into wf/y3-envfile-b6
roodboi Oct 12, 2026
c6055dd
Merge branch 'wf/y3-envfile-b6' into wf/c4-keydiag-b7
roodboi Oct 12, 2026
6a754df
Merge branch 'wf/c4-keydiag-b7' into wf/y4-patterns-b6
roodboi Oct 12, 2026
ef04f02
Merge branch 'wf/y4-patterns-b6' into wf/c5-confighash-b7
roodboi Oct 12, 2026
b0cde14
Merge branch 'wf/c5-confighash-b7' into wf/y5-staleenv-b6
roodboi Oct 12, 2026
5a258e6
Merge branch 'wf/y5-staleenv-b6' into wf/y1-logs-b6
roodboi Oct 12, 2026
642775e
Merge branch 'wf/y1-logs-b6' into wf/y2-mcptools-b6
roodboi Oct 12, 2026
2fa96a2
Merge branch 'wf/y2-mcptools-b6' into wf/c1-stdin-b7
roodboi Oct 12, 2026
30936fe
Merge branch 'wf/c1-stdin-b7' into wf/w08-b6
roodboi Oct 12, 2026
63e1d39
test(native): use a canonical overlay name in the env selection case
roodboi Oct 12, 2026
6ecf485
Merge branch 'wf/c1-stdin-b7' into wf/w08-b6
roodboi Oct 12, 2026
e41b424
Merge branch 'next' into wf/w08-b6
roodboi Oct 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codex/skills/hack-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use `hack` as the primary interface for local-first development.

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

## Product boundary

Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/hack.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Prefer `hack` when shell access is available. Use MCP only when shell access is

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

## Product boundary

Expand Down
15 changes: 14 additions & 1 deletion docs/agent-guidance.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ run only `hack agent prime`. See [model-policy ownership](reference/agent-client
| `src/agents/hack-init-skill.ts` | Thin Claude/Codex/plugin adapter that fetches onboarding guidance |
| `src/agents/init-patterns.ts`, `init-assistant.ts` | Optional init inventory and pattern hints |
| `src/agents/install-skill.ts`, `remote-bootstrap-skill.ts` | Plugin installation/channel selection and fresh-host/cloud setup skills |
| `scripts/generate-agent-plugins.ts` | Portable plugin/MCP manifests, three client compatibility manifests, four skills, and Cursor rule |
| `src/agents/focused-skills.ts` | Plugin `hack-branches`, `hack-env` and `hack-diagnose` skills, composed from canonical section ids, and the plugin `hack-cli` routing description |
| `src/agents/error-code-reference.ts` | `hack-diagnose` error-code reference, rendered from the exported `HACK_ERROR_CODES` registry in `src/lib/cli-result.ts` |
| `scripts/generate-agent-plugins.ts` | Portable plugin/MCP manifests, three client compatibility manifests, seven skills, and Cursor rule |

The portable plugin manifest derives identity and effective OpenAI presentation
from `.codex-plugin/plugin.json`; portable MCP derives from `.mcp.json` with an
Expand Down Expand Up @@ -104,6 +106,17 @@ toolchain service against its card. Every `hack` command in a fixture README
must resolve in CLI_SPEC and name a declared service and profile. These checks
are static: they do not start containers or qualify the runtime gates.

The focused plugin skills `hack-branches`, `hack-env` and `hack-diagnose` list
canonical section ids in `src/agents/focused-skills.ts` and carry no prose of
their own; composition fails on an unknown id. A section with no surface tags
renders only in the focused skills that name it. Each trigger phrase belongs to
one plugin skill, and the plugin `hack-cli` description hands branch, env and
diagnosis intents to them; the standalone `hack-cli` keeps broad routing because
those installs ship no focused skills. The `hack-diagnose` error-code reference
renders from `HACK_ERROR_CODES` in `src/lib/cli-result.ts`.
`tests/focused-skills.test.ts` checks section ids, CLI_SPEC resolution,
error-code parity and trigger overlap.

Skill candidates and where their patterns live now:

| Candidate | Decision | Patterns live in | Promotion owner and missing contract |
Expand Down
11 changes: 7 additions & 4 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ trust and approval rules.
## Optional native plugins

Hack also ships an optional native plugin for Codex, Claude Code, and Cursor in
`plugins/hack`. It bundles four skills (`hack-cli`, `hack-init`, `hack-install`, and
`hack-remote`), the `hack mcp serve` server, Claude primer hooks, and a Cursor rule
that the agent can select when relevant. The
`plugins/hack`. It bundles seven skills (`hack-cli`, the focused `hack-branches`,
`hack-env` and `hack-diagnose`, `hack-init`, `hack-install`, and `hack-remote`), the
`hack mcp serve` server, Claude primer hooks, and a Cursor rule that the agent can
select when relevant. The plugin's `hack-cli` routes branch-instance, env and
diagnosis requests to the focused skills; standalone `hack setup` installs keep the
broad `hack-cli` skill only. The
[agent client capability matrix](reference/agent-client-capabilities.md) records
which of these components have been observed loading in each client.
Install the Hack CLI first and make `hack` available on the client's PATH.
Expand Down Expand Up @@ -105,7 +108,7 @@ outside its local-plugin root; use a copy rather than weakening that boundary. S
[Cursor's plugin documentation](https://cursor.com/docs/plugins) for marketplace
and local development support in the installed client version.

After installing, verify in a fresh session that all four skills are discoverable,
After installing, verify in a fresh session that all seven skills are discoverable,
`hack mcp serve` can initialize, and the client's hooks or rule load. A successful
marketplace registration alone does not prove those components loaded. The plugin's
MCP fallback is for clients without shell access; use the Hack CLI when shell is available.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/agent-client-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Matrix version 1, observed 2026-10-11.
| Capability | Meaning |
| --- | --- |
| Packaging | The client accepts, installs and enables the Hack plugin package in a session. |
| Skill discovery | A fresh session discovers the plugin's bundled skills (hack-cli, hack-init, hack-install, hack-remote). |
| Skill discovery | A fresh session discovers the plugin's bundled skills (hack-cli, hack-branches, hack-env, hack-diagnose, hack-init, hack-install, hack-remote). |
| Hooks | The client runs plugin-shipped hooks; Hack hooks may only run `hack agent prime`. |
| Plugin MCP | The client starts the plugin-declared `hack mcp serve` server and lists its tools. |
| Standalone MCP | The client loads an MCP entry written by `hack mcp install` (stdio or a selected MCP bundle) without the plugin. |
Expand Down Expand Up @@ -117,7 +117,7 @@ owner, and none of them replaces the others. Users choose one per client.

| Layout | What it contains | Authoritative owner | Installed and updated by |
| --- | --- | --- | --- |
| Native plugin (`plugins/hack`) | Client manifests, four skills, Claude primer hooks, Cursor rule, `hack mcp serve` declaration | `scripts/generate-agent-plugins.ts`, rendering from `src/agents/instruction-source.ts` and the skill renderers in `src/agents/` | The client's plugin manager. Hack commands never install or update it. |
| Native plugin (`plugins/hack`) | Client manifests, seven skills, Claude primer hooks, Cursor rule, `hack mcp serve` declaration | `scripts/generate-agent-plugins.ts`, rendering from `src/agents/instruction-source.ts` and the skill renderers in `src/agents/` | The client's plugin manager. Hack commands never install or update it. |
| Standalone setup | Project AGENTS.md/CLAUDE.md snippets, Cursor rules, shared skills, Claude primer hooks, MCP entries | `src/agents/instruction-source.ts` and its renderers, written by `hack setup` and `hack mcp install` | Explicit `hack setup` and `hack mcp install` commands in a chosen scope |
| MCP bundle | Native MCP adapter, owner and backend executables with a content-derived identity | `src/mcp/bundle.ts` (packaging and verification) | `hack mcp install --bundle ... --cli ...` writes the client entry; the bundle is never modified after selection |

Expand Down
2 changes: 1 addition & 1 deletion examples/basic/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use `hack` as the single interface for local-first runtime orchestration (compos
Integration freshness:
- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

Product boundary:
- Supported CLI surface: project init, up/down/restart, open, logs, env, host exec/shell, sessions, doctor, and daemon.
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Use `hack` as the single interface for local-first runtime orchestration (compos
Integration freshness:
- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

Product boundary:
- Supported CLI surface: project init, up/down/restart, open, logs, env, host exec/shell, sessions, doctor, and daemon.
Expand Down
11 changes: 7 additions & 4 deletions plugins/hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
Optional Hack integration for Codex, Claude Code, and Cursor. Install the `hack`
executable first; the plugin uses it from PATH.

The bundle contains four skills:
The bundle contains seven skills:

- `hack-cli`: services, logs, environments, worktrees and diagnostics.
- `hack-cli`: services, logs, routed URLs, lifecycle and workspaces.
- `hack-branches`: parallel branch instances (`--branch <name>`) and branch aliases.
- `hack-env`: env values, overlays and worktree-local overrides without exposing secrets.
- `hack-diagnose`: read-first diagnosis and the `--json` error-code reference.
- `hack-init`: configure a new or existing project for Hack.
- `hack-install`: installation, stable/prerelease selection, upgrade and rollback.
- `hack-remote`: prepare an existing project on another machine or in Codex Cloud.
Expand All @@ -26,7 +29,7 @@ that selection and disable the bundle's MCP entry in the client configuration:
enabled = false
```

This keeps the four plugin skills available without launching a second bundled
This keeps the seven plugin skills available without launching a second bundled
server. A standalone registration remains independently configured. Preserve
existing customized skills; resolve overlapping installation paths deliberately.

Expand All @@ -38,7 +41,7 @@ codex plugin add hack@hack-dance
codex plugin list --json --marketplace hack-dance
```

Start a fresh client, confirm all four plugin skills load, and call a harmless
Start a fresh client, confirm all seven plugin skills load, and call a harmless
MCP tool such as `hack.projects.list` against an isolated registry. Inspect
actual discovered tool names first.
The server and Claude hooks still resolve `hack` from the client's PATH; installing
Expand Down
2 changes: 1 addition & 1 deletion plugins/hack/rules/hack.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Prefer `hack` when shell access is available. Use MCP only when shell access is

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

## Product boundary

Expand Down
38 changes: 38 additions & 0 deletions plugins/hack/skills/hack-branches/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: hack-branches
description: >
Run parallel branch instances of a Hack project with `--branch <name>` and manage their aliases
with `hack branch`. Trigger when asked to run two versions of a project side by side; start,
open, tail or stop a branch instance; review a pull request in its own instance; or add, list,
open or remove a branch alias.
---

# Hack branch instances

## Branch instances (parallel envs)

- Use a branch instance when you need two versions running at once (PR review, experiments, migrations) or want to keep a stable environment while testing another branch.
- Target one with `--branch <name>` on up/open/logs/down (for example: `hack up --branch <name> --detach`).
- Linked worktrees pick a branch instance automatically (see Linked git worktrees).
- Containers receive `HACK_RUNTIME_METADATA` plus `HACK_DEV_URL`, `HACK_ALIAS_URL`, and current-service URL fields derived from effective Caddy routes. Use Compose DNS for internal traffic and this metadata for browser-facing links, OAuth callbacks, and webhooks.

## Branch aliases

- Aliases are entries in `.hack/hack.branches.json`; `hack up --branch <name>` records or refreshes its entry automatically.
- `hack branch add <name> --note <text>` registers one ahead of time, and `hack branch list` shows each alias with its note and last use.
- `hack branch open <name>` opens that branch's routed host; `hack branch open <name> --prefer <auto|alias|dev>` selects which host.
- `hack branch remove <name>` deletes only the alias entry and leaves any running instance alone; stop the instance with `hack down --branch <name>`.

## Linked git worktrees (optional)

- Secret key inherits from the primary checkout automatically through the shared git common dir; set `HACK_ENV_SECRET_KEY` for CI or detached environments.
- `hack up` in a linked worktree defaults to a branch instance named after the worktree's git branch; a detached linked worktree requires an explicit `--branch`, unless config `worktree.auto_branch=false` explicitly opts into the base instance.
- Before `hack up` or `hack restart` auto-targets a new branch instance, Hack warns when the same worktree already owns a non-terminal instance; pass `--branch <name>` to make the target explicit.
- Implicit `hack down` retargets a uniquely owned same-checkout runtime after a Git branch rename, including Created and stopped containers; when multiple runtimes belong to the checkout, pass `--branch <name>` explicitly.
- `hack doctor` flags divergent secret keys and dev_host collisions across checkouts.

## Integration freshness

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).
10 changes: 6 additions & 4 deletions plugins/hack/skills/hack-cli/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
name: hack-cli
description: >
Use the hack CLI for local runtime orchestration (compose, DNS/TLS, logs, env, persistent project workspaces) and agent setup.
Trigger when asked to run/start/stop services, inspect logs, manage lifecycle/workspace workflows, or update
agent integrations. Prefer CLI over MCP when shell access is available.
Use the hack CLI for local runtime orchestration (compose, DNS/TLS, routed URLs, persistent
project workspaces) and agent setup. Trigger when asked to run, start or stop services; tail
service logs; open a routed app URL; manage lifecycle or workspace workflows; or update agent
integrations. Use hack-branches for branch instances, hack-env for env values and hack-diagnose
for a failing project. Prefer CLI over MCP when shell access is available.
---

# hack CLI
Expand All @@ -14,7 +16,7 @@ Use `hack` as the primary interface for local-first development.

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `c3c646a036aa` (version alone is not a freshness guarantee).
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

## Product boundary

Expand Down
44 changes: 44 additions & 0 deletions plugins/hack/skills/hack-diagnose/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: hack-diagnose
description: >
Diagnose a Hack-managed project by reading its state first and repairing only within the
request. Trigger when asked to find out why a service is unhealthy or did not start; interpret
an E_* error code from a JSON envelope; review hack doctor findings; or investigate routing or
global infrastructure failures.
---

# Diagnose a Hack project

## Read-first diagnosis

- Read before changing anything, in this order, and stop once the cause is clear:
- Step 1, `hack ps --json`: which services exist and their state.
- Step 2, `hack doctor --json`: findings and stable E_* codes.
- Step 3, `hack logs --json --no-follow --tail 200`: a finite snapshot; add a service name to narrow it.
- Step 4, `hack env explain <key> --service <service>`: only when a value is suspect; it reports provenance without the value.
- Step 5, `hack global status`: shared proxy, DNS and logging infrastructure.
- Branch on `error.code`, not on message text; the code is the stable contract and the message may change.
- Report what each read showed before proposing a repair.

## Operating rules

- Prefer `hack` over raw `docker` / `docker compose` for project workflows.
- Do not start/stop services from Docker Desktop UI for `hack`-managed projects.
- Treat `.hack/.internal` and `.hack/.branch` as hack-managed artifacts; do not hand-edit generated files there.
- Use `--json` for machine-readable output when available; `hack up/down/restart/doctor --json` emit an `{ok, data | error: {code, message}}` envelope with stable E_* error codes.
- When the exit status matters, do not pipe `hack` output through `| tail` or `| grep`: the pipeline reports the filter's status, and filtered text can hide failures. Check the `hack` exit status or `--json` envelope first, and use finite reads such as `hack logs --no-follow --tail 100`.
- Scripted/agent runs: pass `--no-interactive` (or set `HACK_NO_INTERACTIVE=1`) so commands never block on prompts — they apply documented defaults or fail fast with E_INTERACTIVE_REQUIRED.
- Use MCP only when shell access is unavailable.
- A task request authorizes its stated scope, not unrelated service, global config, or production changes. Preserve native credential/trust approvals and destructive-cleanup gates; do not ask again for the same authorized action.
- Cleanup must prove resource ownership. Successful one-shot containers may exit with code 0; adopted external processes must remain running when Hack stops its own services.
- If runtime state looks wrong, inspect with `hack doctor`; apply `hack doctor --fix` only for repairs covered by the request. Warnings do not authorize broader changes.

## Integration freshness

- These instructions were generated by hack CLI v4.2.1; use the content revision and command behavior to assess freshness.
- Check guidance only when Hack is relevant and there is evidence of drift; use targeted `hack setup` checks for a read-only inventory. Routine tasks do not require a startup audit.
- Content revision: `9f26e5752230` (version alone is not a freshness guarantee).

## References

- [Error codes](references/error-codes.md): every stable `--json` error code with its meaning and the first read-only step.
Loading
Loading