@ethlete/agent-rules 0.1.0-next.5 → 0.1.0-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +28 -0
- package/CHANGELOG.md +759 -0
- package/CLAUDE.md +1 -0
- package/README.md +434 -25
- package/THIRD-PARTY-LICENSES.md +35 -0
- package/content/defaults.json +1 -1
- package/content/git-hooks/post-checkout.sh +10 -0
- package/content/git-hooks/pre-push.sh +5 -0
- package/content/hooks/away-mode.py +327 -0
- package/content/hooks/background-design-commands.py +228 -0
- package/content/hooks/builder-idle-check.py +397 -0
- package/content/hooks/context-warning.py +694 -134
- package/content/hooks/design-live-check.py +136 -0
- package/content/hooks/git-safety.py +213 -0
- package/content/hooks/human-wait-check.py +167 -0
- package/content/hooks/subagent-model-policy.py +261 -0
- package/content/mods/.claude-plugin/marketplace.json +26 -0
- package/content/mods/plugins/codex-runs/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/codex-runs/hooks/hooks.json +1 -0
- package/content/mods/plugins/codex-runs/hooks/progress.ts +130 -0
- package/content/mods/plugins/codex-runs/hooks/register.tsx +103 -0
- package/content/mods/plugins/codex-runs/tsconfig.json +4 -0
- package/content/mods/plugins/codex-runs/types/index.d.ts +19 -0
- package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
- package/content/mods/plugins/e2e-progress/hooks/progress.ts +160 -0
- package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
- package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
- package/content/mods/plugins/e2e-progress/types/index.d.ts +26 -0
- package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/status-line/hooks/line.ts +74 -0
- package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
- package/content/mods/plugins/status-line/types/index.d.ts +5 -0
- package/content/mods/plugins/usage-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/usage-line/hooks/codex.ts +52 -0
- package/content/mods/plugins/usage-line/hooks/format.ts +24 -0
- package/content/mods/plugins/usage-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/usage-line/hooks/register.tsx +67 -0
- package/content/mods/plugins/usage-line/tsconfig.json +4 -0
- package/content/mods/plugins/usage-line/types/index.d.ts +5 -0
- package/content/output-styles/ste-clarity.md +131 -0
- package/content/rules/agent-sessions-wake-up.md +11 -0
- package/content/rules/app-styling.md +66 -0
- package/content/rules/comments.md +4 -1
- package/content/rules/lint-and-format.md +7 -5
- package/content/rules/nx-layout.md +53 -0
- package/content/rules/reactive-state.md +1 -1
- package/content/rules/styling.md +19 -10
- package/content/rules/subagent-models.md +42 -0
- package/content/rules/waiting-on-the-human.md +17 -0
- package/content/skills/agent-sessions/SKILL.md +100 -0
- package/content/skills/agent-sessions/agent-sessions.mjs +1420 -0
- package/content/skills/angular-patterns/SKILL.md +31 -7
- package/content/skills/api-source/SKILL.md +156 -0
- package/content/skills/app-testing/SKILL.md +141 -0
- package/content/skills/codex-subagent/SKILL.md +96 -0
- package/content/skills/codex-subagent/codex-agent.mjs +229 -0
- package/content/skills/codex-subagent/codex-limit.mjs +106 -0
- package/content/skills/design-exploration/SKILL.md +203 -0
- package/content/skills/design-exploration/check-story.mjs +139 -0
- package/content/skills/design-exploration/reference-check-and-notes.md +101 -0
- package/content/skills/design-exploration/reference-flows.md +38 -0
- package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
- package/content/skills/design-exploration/reference-order-and-design-system.md +120 -0
- package/content/skills/design-exploration/reference-products-and-sketches.md +250 -0
- package/content/skills/design-exploration/reference-shots.md +25 -0
- package/content/skills/design-exploration/shoot-template.mjs +61 -0
- package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/content/skills/domain-modeling/SKILL.md +71 -0
- package/content/skills/e2e-triage/SKILL.md +80 -0
- package/content/skills/figma-export/SKILL.md +16 -18
- package/content/skills/git-commit/SKILL.md +21 -7
- package/content/skills/git-flow/SKILL.md +87 -0
- package/content/skills/grill-with-docs/SKILL.md +13 -0
- package/content/skills/grilling/SKILL.md +52 -0
- package/content/skills/handoff/SKILL.md +29 -69
- package/content/skills/handoff/save.md +187 -0
- package/content/skills/query/SKILL.md +165 -70
- package/content/skills/report/SKILL.md +26 -0
- package/content/skills/rxjs-signals/SKILL.md +33 -4
- package/content/skills/sdk-docs/SKILL.md +50 -14
- package/content/skills/sdk-local-build/SKILL.md +26 -8
- package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
- package/content/skills/sdk-source/SKILL.md +37 -34
- package/content/skills/sdk-update/SKILL.md +103 -0
- package/content/skills/story-styling/SKILL.md +12 -10
- package/content/skills/styleguide/SKILL.md +13 -8
- package/content/skills/styleguide/assets.md +54 -0
- package/content/skills/styleguide/changesets.md +17 -0
- package/content/skills/styleguide/file-structure.md +73 -0
- package/content/skills/styleguide/lint-rule-lookup.md +52 -0
- package/content/skills/styleguide/storybook-structure.md +25 -0
- package/content/skills/theming/SKILL.md +76 -49
- package/content/skills/timetrack/SKILL.md +324 -0
- package/content/skills/verify-in-app/SKILL.md +107 -0
- package/content/skills/verify-in-storybook/SKILL.md +1 -1
- package/migrations/list-state-query-form.md +20 -0
- package/migrations/nx-layout.md +29 -0
- package/migrations/sdk-components-over-hand-built-ui.md +27 -0
- package/migrations/search-query-field.md +52 -0
- package/migrations.json +39 -0
- package/package.json +19 -3
- package/src/index.js +99 -32
- package/src/index.js.map +1 -1
- package/src/lib/cli-args.d.ts +9 -0
- package/src/lib/cli-args.js +48 -0
- package/src/lib/cli-args.js.map +1 -0
- package/src/lib/commitlint.d.ts +10 -0
- package/src/lib/commitlint.js +51 -0
- package/src/lib/commitlint.js.map +1 -0
- package/src/lib/config.d.ts +68 -6
- package/src/lib/config.js +141 -11
- package/src/lib/config.js.map +1 -1
- package/src/lib/filter.d.ts +2 -0
- package/src/lib/filter.js +4 -4
- package/src/lib/filter.js.map +1 -1
- package/src/lib/frontmatter.d.ts +2 -0
- package/src/lib/frontmatter.js +33 -5
- package/src/lib/frontmatter.js.map +1 -1
- package/src/lib/git-flow/build.d.ts +35 -0
- package/src/lib/git-flow/build.js +24 -0
- package/src/lib/git-flow/build.js.map +1 -0
- package/src/lib/git-flow/config.d.ts +59 -0
- package/src/lib/git-flow/config.js +50 -0
- package/src/lib/git-flow/config.js.map +1 -0
- package/src/lib/git-flow/index.d.ts +6 -0
- package/src/lib/git-flow/index.js +23 -0
- package/src/lib/git-flow/index.js.map +1 -0
- package/src/lib/git-flow/parse.d.ts +49 -0
- package/src/lib/git-flow/parse.js +300 -0
- package/src/lib/git-flow/parse.js.map +1 -0
- package/src/lib/git-flow/rename.d.ts +24 -0
- package/src/lib/git-flow/rename.js +70 -0
- package/src/lib/git-flow/rename.js.map +1 -0
- package/src/lib/git-flow/start.d.ts +49 -0
- package/src/lib/git-flow/start.js +57 -0
- package/src/lib/git-flow/start.js.map +1 -0
- package/src/lib/git-flow/validate.d.ts +34 -0
- package/src/lib/git-flow/validate.js +72 -0
- package/src/lib/git-flow/validate.js.map +1 -0
- package/src/lib/git-flow-command.d.ts +4 -0
- package/src/lib/git-flow-command.js +165 -0
- package/src/lib/git-flow-command.js.map +1 -0
- package/src/lib/git-flow-repair.d.ts +17 -0
- package/src/lib/git-flow-repair.js +165 -0
- package/src/lib/git-flow-repair.js.map +1 -0
- package/src/lib/git-flow-start.d.ts +20 -0
- package/src/lib/git-flow-start.js +140 -0
- package/src/lib/git-flow-start.js.map +1 -0
- package/src/lib/git-test-env.fixtures.d.ts +11 -0
- package/src/lib/git-test-env.fixtures.js +31 -0
- package/src/lib/git-test-env.fixtures.js.map +1 -0
- package/src/lib/git.d.ts +64 -0
- package/src/lib/git.js +131 -0
- package/src/lib/git.js.map +1 -0
- package/src/lib/gitlab.d.ts +35 -0
- package/src/lib/gitlab.js +116 -0
- package/src/lib/gitlab.js.map +1 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +26 -11
- package/src/lib/index.js.map +1 -1
- package/src/lib/migrate.js +8 -2
- package/src/lib/migrate.js.map +1 -1
- package/src/lib/output-style-command.d.ts +3 -0
- package/src/lib/output-style-command.js +69 -0
- package/src/lib/output-style-command.js.map +1 -0
- package/src/lib/output-style.d.ts +38 -0
- package/src/lib/output-style.js +134 -0
- package/src/lib/output-style.js.map +1 -0
- package/src/lib/owned-paths.js +8 -2
- package/src/lib/owned-paths.js.map +1 -1
- package/src/lib/package-runner.d.ts +4 -0
- package/src/lib/package-runner.js +86 -0
- package/src/lib/package-runner.js.map +1 -0
- package/src/lib/peer-path.d.ts +12 -0
- package/src/lib/peer-path.js +39 -0
- package/src/lib/peer-path.js.map +1 -0
- package/src/lib/plain-text.d.ts +9 -0
- package/src/lib/plain-text.js +22 -0
- package/src/lib/plain-text.js.map +1 -0
- package/src/lib/plan.d.ts +6 -6
- package/src/lib/plan.js +167 -39
- package/src/lib/plan.js.map +1 -1
- package/src/lib/prettier.d.ts +21 -0
- package/src/lib/prettier.js +51 -0
- package/src/lib/prettier.js.map +1 -0
- package/src/lib/prompt.d.ts +8 -0
- package/src/lib/prompt.js +35 -0
- package/src/lib/prompt.js.map +1 -0
- package/src/lib/render.d.ts +26 -2
- package/src/lib/render.js +45 -10
- package/src/lib/render.js.map +1 -1
- package/src/lib/report-command.d.ts +34 -0
- package/src/lib/report-command.js +316 -0
- package/src/lib/report-command.js.map +1 -0
- package/src/lib/sessions-command.d.ts +4 -0
- package/src/lib/sessions-command.js +16 -0
- package/src/lib/sessions-command.js.map +1 -0
- package/src/lib/sync.d.ts +1 -2
- package/src/lib/sync.js +37 -17
- package/src/lib/sync.js.map +1 -1
- package/src/lib/targets/agents-skills.js +1 -1
- package/src/lib/targets/agents-skills.js.map +1 -1
- package/src/lib/targets/claude-hooks.d.ts +5 -0
- package/src/lib/targets/claude-hooks.js +27 -4
- package/src/lib/targets/claude-hooks.js.map +1 -1
- package/src/lib/targets/claude-mods.d.ts +20 -0
- package/src/lib/targets/claude-mods.js +47 -0
- package/src/lib/targets/claude-mods.js.map +1 -0
- package/src/lib/targets/claude.js +2 -3
- package/src/lib/targets/claude.js.map +1 -1
- package/src/lib/targets/codex-hooks.js +4 -2
- package/src/lib/targets/codex-hooks.js.map +1 -1
- package/src/lib/targets/codex.js +4 -4
- package/src/lib/targets/codex.js.map +1 -1
- package/src/lib/targets/copilot.js +4 -4
- package/src/lib/targets/copilot.js.map +1 -1
- package/src/lib/targets/cursor.js +3 -3
- package/src/lib/targets/cursor.js.map +1 -1
- package/src/lib/targets/git-hooks.d.ts +25 -0
- package/src/lib/targets/git-hooks.js +71 -0
- package/src/lib/targets/git-hooks.js.map +1 -0
- package/src/lib/targets/hooks-shared.d.ts +29 -5
- package/src/lib/targets/hooks-shared.js +130 -36
- package/src/lib/targets/hooks-shared.js.map +1 -1
- package/src/lib/targets/mcp.d.ts +16 -0
- package/src/lib/targets/mcp.js +72 -0
- package/src/lib/targets/mcp.js.map +1 -0
- package/src/lib/targets/shared.d.ts +1 -9
- package/src/lib/targets/shared.js +4 -8
- package/src/lib/targets/shared.js.map +1 -1
- package/src/lib/timetrack-command.d.ts +11 -0
- package/src/lib/timetrack-command.js +1262 -0
- package/src/lib/timetrack-command.js.map +1 -0
- package/src/lib/timetrack-snapshot.d.ts +66 -0
- package/src/lib/timetrack-snapshot.js +146 -0
- package/src/lib/timetrack-snapshot.js.map +1 -0
- package/src/lib/timetrack.d.ts +607 -0
- package/src/lib/timetrack.js +285 -0
- package/src/lib/timetrack.js.map +1 -0
- package/content/skills/styleguide/STYLEGUIDE.md +0 -520
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nx-layout
|
|
3
|
+
description: Nx workspace layout - thin apps, feature code in libs grouped by kind, path-mirroring aliases, scope tags.
|
|
4
|
+
kind: rule
|
|
5
|
+
scope: consumer
|
|
6
|
+
requires: ['nx']
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Nx workspace layout
|
|
10
|
+
|
|
11
|
+
Apps are thin shells. All feature code lives in libs, grouped by kind, not by Nx type:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
apps/<app>/src/app/ app.component.ts, app.config.ts, app.routes.ts only
|
|
15
|
+
libs/
|
|
16
|
+
domain/<app>/ one lib per app
|
|
17
|
+
src/lib/<feature>/ views, components, services, <feature>.routes.ts
|
|
18
|
+
src/lib/shared/ code shared by the app's features (optional)
|
|
19
|
+
queries/ query clients and creators, one folder per backend
|
|
20
|
+
types/ API models and shared types
|
|
21
|
+
uikit/ app-agnostic presentational components
|
|
22
|
+
theme/ surface and colour themes
|
|
23
|
+
env/ environment.ts, environment.production.ts
|
|
24
|
+
assets/ fonts, icons, images
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Each feature folder exports its own `<FEATURE>_ROUTES`, re-exported from the lib's
|
|
28
|
+
`src/index.ts`. `app.routes.ts` only lazy-loads them:
|
|
29
|
+
`loadChildren: () => import('@acme/domain/admin').then((m) => m.USERS_ROUTES)`.
|
|
30
|
+
- Split a feature into its own lib (`libs/domain/<app>/<feature>`) only for a concrete
|
|
31
|
+
reason, such as size or build time, and name that reason to the user.
|
|
32
|
+
Never put features, queries, shared UI or theme in the app project.
|
|
33
|
+
- Do not add Nx `feature/ui/data-access/util` folders or `type:*` tags.
|
|
34
|
+
- Every lib has `src/index.ts` and an explicit `build` target in `project.json`
|
|
35
|
+
(`@nx/angular:ng-packagr-lite`). `lint` and `test` are inferred by the plugins in `nx.json`
|
|
36
|
+
(`@nx/eslint/plugin`, and `@nx/vite/plugin` or `@nx/jest/plugin` for the test runner), so
|
|
37
|
+
do not write `@nx/eslint:lint` or `@nx/jest:jest` executor targets by hand. Nx 24 has no
|
|
38
|
+
such executors. Run `npx nx show project <name>` to see the inferred targets.
|
|
39
|
+
- Alias = path with slashes: `@acme/domain/admin`, `@acme/queries`, `@acme/types`,
|
|
40
|
+
`@acme/uikit`, `@acme/env`. Project name = path with dashes (`domain-admin`).
|
|
41
|
+
Component `prefix` = the repo abbreviation.
|
|
42
|
+
- Tag every project with one `scope:*`: `scope:<app>` for an app and its domain libs,
|
|
43
|
+
`scope:core` for env and types, plus `scope:queries`, `scope:uikit`, `scope:theme`.
|
|
44
|
+
`@nx/enforce-module-boundaries` with `enforceBuildableLibDependency: true` lets
|
|
45
|
+
`scope:<app>` depend on itself and the shared scopes, never on another app.
|
|
46
|
+
- A backend in the same workspace is an app in `apps/` with its libs in
|
|
47
|
+
`libs/domain/<name>-api`. Ban `@angular/*` in backend scopes and `@nestjs/*` in frontend
|
|
48
|
+
scopes with `bannedExternalImports`.
|
|
49
|
+
- Environment config lives only in `libs/env`, never hardcoded in a query client.
|
|
50
|
+
|
|
51
|
+
This is the layout for new workspaces and new code. Do not restructure the folders, projects
|
|
52
|
+
and tags of an existing workspace that deviates from it unless the user asks. This covers the
|
|
53
|
+
workspace layout only: every other rule still applies to the code you touch.
|
|
@@ -12,4 +12,4 @@ scope: both
|
|
|
12
12
|
- **Bridge, don't copy.** Cross the boundary with `toSignal()` / `toObservable()`, never by
|
|
13
13
|
`.subscribe()`-ing and assigning the value somewhere.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
For subscriptions and effects, load the repository's focused reactive-state guidance.
|
package/content/rules/styling.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: styling
|
|
3
|
-
description: Component CSS is plain CSS in @layer components, and
|
|
3
|
+
description: Component CSS is plain CSS in @layer components.sdk, and hardcoded colours are never primary values.
|
|
4
4
|
kind: rule
|
|
5
|
-
scope:
|
|
5
|
+
scope: sdk
|
|
6
6
|
requires: ['@ethlete/core']
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -13,23 +13,32 @@ Component styles are **plain CSS** — global `et-`-prefixed classes with
|
|
|
13
13
|
in component source.** Utilities belong in application templates and story files, not in
|
|
14
14
|
the stylesheet a component ships.
|
|
15
15
|
|
|
16
|
-
**Wrap every component CSS file in `@layer components { … }`** — the whole file inside
|
|
17
|
-
block. Component CSS is injected as a global `<style>` tag; unlayered, it beats Tailwind v4
|
|
16
|
+
**Wrap every component CSS file in `@layer components.sdk { … }`** — the whole file inside
|
|
17
|
+
one block. Component CSS is injected as a global `<style>` tag; unlayered, it beats Tailwind v4
|
|
18
18
|
utilities (which live in `@layer utilities`) regardless of specificity, because layer
|
|
19
19
|
precedence is resolved before specificity — so overriding `.et-button` would need
|
|
20
20
|
`flex!` instead of `flex`. `:where()` does not help across layers. Tailwind v4 pre-declares
|
|
21
21
|
`@layer theme, base, components, utilities`, so the wrap puts component styles where a
|
|
22
|
-
utility can win.
|
|
22
|
+
utility can win. `components.sdk` is nested in `components`, and a layer's own rules beat its
|
|
23
|
+
nested layers, so an app rule in `@layer components` also wins. Never wrap SDK CSS in plain
|
|
24
|
+
`@layer components`: it would tie with the app's rules again.
|
|
23
25
|
|
|
24
26
|
`:where()` has a separate job: keeping a component's own config modifiers
|
|
25
27
|
(`[data-size]`, `[data-variant]`, `[disabled]`) at the same single-class weight as its base
|
|
26
28
|
rule, so source order decides. Leave interaction states (`:hover`, `:focus-visible`,
|
|
27
29
|
`:active`) bare so they escalate and win.
|
|
28
30
|
|
|
29
|
-
**Never
|
|
30
|
-
from the surface and colour theming tokens
|
|
31
|
-
|
|
31
|
+
**Never use a hardcoded colour as the primary value.** Backgrounds, text, borders and
|
|
32
|
+
interaction states resolve from the surface and colour theming tokens
|
|
33
|
+
(`--et-surface-*`, `--et-tone-*`). A static fallback inside
|
|
34
|
+
`var(--token, <fallback>)` is permitted, but not required.
|
|
32
35
|
|
|
33
36
|
Theme **names** (`brand`, `danger`, `dark-elevated`, …) are registered by the application;
|
|
34
|
-
the SDK ships none. Never hardcode
|
|
35
|
-
|
|
37
|
+
the SDK ships none. Never hardcode them as an SDK-defined union or reusable API contract.
|
|
38
|
+
If an app-specific example names one, label it as belonging to that app. Semantic colours
|
|
39
|
+
resolve by theme `type` (e.g. `injectSemanticColorTheme('error')`).
|
|
40
|
+
|
|
41
|
+
**Style an SDK component's state through its inputs.** A pressed, active, selected or loading
|
|
42
|
+
look comes from the component's state inputs (`pressed`, `pressedColor`, `variant`, `color`),
|
|
43
|
+
never from a `!`-utility or an override of an `--et-*` custom property in an app template. If
|
|
44
|
+
no input fits, ask the doc session for one instead of building the override.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: subagent-models
|
|
3
|
+
description: A subagent runs on sonnet unless its call names a model - haiku for lookups and small specified jobs, opus for hard work, fable for judgment.
|
|
4
|
+
kind: rule
|
|
5
|
+
scope: both
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Delegating: sonnet by default
|
|
9
|
+
|
|
10
|
+
A subagent spawned without a `model` would run on the model leading the session, so an expensive
|
|
11
|
+
model would do every small job it delegates. The `subagent-model-policy` hook fills in **`sonnet`**
|
|
12
|
+
for such a call. Name another model only when the task matches its row below - `opus` only for the
|
|
13
|
+
work its row lists:
|
|
14
|
+
|
|
15
|
+
| Model | The work it fits |
|
|
16
|
+
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `haiku` | Lookups and small, fully specified jobs: grep, find, read and summarize files or a CI log, run a command and report, a mechanical edit in named files. Haiku 5.5 does these well. |
|
|
18
|
+
| `sonnet` | Scoped work with a clear target: a fix in a named file, a spec, a docs page, a lint cleanup, research that needs reasoning. Sonnet 5.5 is close to opus here and costs less. |
|
|
19
|
+
| `opus` | Hard work: a bug with no known cause, a change across many files, a review of a diff, and any task sonnet did not finish. |
|
|
20
|
+
| `fable` | Judgment-heavy work: planning, design, cross-cutting review, leading other subagents. The most expensive of the four, so ask the user before picking it. |
|
|
21
|
+
|
|
22
|
+
Effort follows the prompt, not a parameter: scope the prompt to one question, name what "done"
|
|
23
|
+
means, and say "keep it brief" for a lookup. Two calls need no `model` of their own - a named
|
|
24
|
+
agent type carries the model and reasoning effort its own definition sets, and a fork always
|
|
25
|
+
inherits the parent's model.
|
|
26
|
+
|
|
27
|
+
A subagent starts cold: it loads the full start context (about 50k tokens) before its first step,
|
|
28
|
+
and measured subagents cost as much as the sessions that spawn them. A lookup or job of under about 10 tool
|
|
29
|
+
calls stays in the session. Give each subagent one large slice, not several small ones, and name the files and line ranges
|
|
30
|
+
in its prompt so it does not search for them. Stop each
|
|
31
|
+
background subagent with `TaskStop` once its result is in, so finished ones do not pile up.
|
|
32
|
+
|
|
33
|
+
A subagent has the same context budget as the session, measured on its own transcript, and the
|
|
34
|
+
context-warning hook tells it to hand back at the critical tier. Size each prompt to fit: one
|
|
35
|
+
slice of work, the files it needs named, and "keep your context small - no whole big files".
|
|
36
|
+
Work that will not fit goes to several subagents in sequence, a fresh one per slice; a subagent
|
|
37
|
+
that hands back early names its remaining steps, which become the next one's prompt.
|
|
38
|
+
|
|
39
|
+
A subagent does not have to be a Claude one. Delegate to a Codex agent where another model
|
|
40
|
+
family would answer better - a second opinion, a review of your own diff, a bug hunt your own
|
|
41
|
+
reading failed - and whenever the Claude usage limit is close, because a Codex run does not draw
|
|
42
|
+
on it. Read {%skill:codex-subagent%} first.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: waiting-on-the-human
|
|
3
|
+
description: A turn that ends with a question or a `!` command for the human starts the next independent slice first; a recurring allowed action becomes a proposed permission rule.
|
|
4
|
+
kind: rule
|
|
5
|
+
scope: both
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Waiting on the human
|
|
9
|
+
|
|
10
|
+
A turn that ends with a question or a `! <command>` for the human is not a reason to idle. Before you
|
|
11
|
+
end it, start the next slice that does not need the answer (or a subagent on it), then ask. If every open
|
|
12
|
+
item needs the answer, say which item waits on what. The `human-wait-check` hook blocks such a stop
|
|
13
|
+
once while slots are free and the queue or the resumed handoff's Next steps list work.
|
|
14
|
+
|
|
15
|
+
When the human allows an action the permission mode keeps refusing (a label, a pipeline retry), write
|
|
16
|
+
no memory or handoff note as the fix: propose the exact permission rule for the settings file (for
|
|
17
|
+
example `Bash(glab mr update:*)`) and let the human add it. Never edit a settings permission rule yourself.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-sessions
|
|
3
|
+
description: 'Run agents in tmux sessions of one checkout: message, wake, restart them, claim paths. Read before editing a shared file while another agent may be active, or on "mailbox", "claim a file", "restart the session".'
|
|
4
|
+
kind: skill
|
|
5
|
+
scope: both
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Agent sessions
|
|
9
|
+
|
|
10
|
+
One script, {%resource:agent-sessions.mjs%}, does three jobs for the agents of one checkout:
|
|
11
|
+
|
|
12
|
+
- **Sessions.** It runs each agent in a `tmux` session, and it can clear a session and start it with a prompt.
|
|
13
|
+
- **Messages.** Agents send each other messages through an append-only JSON-lines file, the mailbox. A dispatcher wakes an idle agent.
|
|
14
|
+
- **Claims.** An agent announces the paths it edits, so two agents do not overwrite each other.
|
|
15
|
+
|
|
16
|
+
Below, `<skill-dir>` is the directory this file sits in, and `<name>` is your own sender name. Where
|
|
17
|
+
the `ethlete-agents` package is a dependency, `npx ethlete-agents sessions <command>` runs the same
|
|
18
|
+
script, so you do not need `<skill-dir>`. The older name `npx ethlete-agents mailbox` works too.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node <skill-dir>/agent-sessions.mjs run <name> <command...> [--role builder] [--dry-run]
|
|
22
|
+
node <skill-dir>/agent-sessions.mjs up <name>[=<command>]...
|
|
23
|
+
node <skill-dir>/agent-sessions.mjs restart <name> [--after <seconds>] [--notify <agent,...>] [--process [--config <dir>]] [--role builder|none] <prompt...>
|
|
24
|
+
node <skill-dir>/agent-sessions.mjs down [<name>...]
|
|
25
|
+
node <skill-dir>/agent-sessions.mjs shell-install [<agent>...] [--file <path>] [--remove] [--dry-run]
|
|
26
|
+
node <skill-dir>/agent-sessions.mjs shell-init [<agent>...]
|
|
27
|
+
node <skill-dir>/agent-sessions.mjs send <name> [--to <agent>] '<message>'
|
|
28
|
+
node <skill-dir>/agent-sessions.mjs inbox <name> [--wait <seconds>]
|
|
29
|
+
node <skill-dir>/agent-sessions.mjs read [--last <n>] [--all]
|
|
30
|
+
node <skill-dir>/agent-sessions.mjs watch <name>
|
|
31
|
+
node <skill-dir>/agent-sessions.mjs dispatch
|
|
32
|
+
node <skill-dir>/agent-sessions.mjs claim <name> <path...> [--ttl <hours>] [--force]
|
|
33
|
+
node <skill-dir>/agent-sessions.mjs release <name> [path...]
|
|
34
|
+
node <skill-dir>/agent-sessions.mjs claims
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick start for a person
|
|
38
|
+
|
|
39
|
+
Nothing runs until you start it, so a person who does not use this does nothing. To try it:
|
|
40
|
+
|
|
41
|
+
1. Run `node <skill-dir>/agent-sessions.mjs shell-install`. It adds one function per agent to your shell file.
|
|
42
|
+
2. Open a new terminal. In the repo, type `claude` or `codex` as usual. The function starts the agent in a `tmux` session and starts the dispatcher.
|
|
43
|
+
3. Ask one agent to message the other. An idle agent wakes when a message carries `--to <agent>`.
|
|
44
|
+
4. Run `node <skill-dir>/agent-sessions.mjs down` to stop the dispatcher. Run `shell-install --remove` to undo step 1.
|
|
45
|
+
|
|
46
|
+
## Sessions
|
|
47
|
+
|
|
48
|
+
`run <name> <command...>` starts the command in the `tmux` session `<name>@<repo>`, or attaches if it runs already. It also starts the dispatcher when none runs, as do `up` and `restart`. Session names carry the repo name, so `codex` in two repos never collides. If that session has a terminal attached already, `run` starts `<name>-2`, then `<name>-3`, and so on. A detached session is attached again. Without a terminal, for example from an agent's shell tool, `run` starts the session detached and prints how to attach. `--role builder` sets `ETHLETE_AGENT_ROLE=builder` and, for `claude`, appends a system prompt that keeps the chat silent and sends reports to the grill session. Every agent `run` starts, and every process `restart --process` starts, gets `CLAUDE_CODE_TMPDIR=~/.cache/claude-tmp`, so a full `/tmp` does not stop its shell. `--dry-run` prints the command instead of starting it.
|
|
49
|
+
|
|
50
|
+
`up codex=codex gemini=gemini` starts a detached `tmux` session per agent, named like its sender name, and runs the command in it. It also starts a session named `mailbox-dispatch` that runs `dispatch`. A running session is left alone. Attach to a session with `tmux attach -t <name>`. Detach with `Ctrl-b`, then `d`. The session and its agent keep running. Use `down` to stop the dispatcher and the named sessions.
|
|
51
|
+
|
|
52
|
+
`restart <name> <prompt...>` types the clear command (`/clear`, or `/new` for a `codex` name) and then the prompt into the session `<name>@<repo>`. Background shells and agents keep running. Their reports can start a turn after the clear, so it types the prompt only once the pane is idle again, and types it again while the prompt still holds it after Enter. The command returns at once, so end your turn after it. While a restart is pending, a second one is refused, and the dispatcher types no message into that session until the resumed agent started its first turn; the marker is `.ethlete/restart.lock.<session>`.
|
|
53
|
+
|
|
54
|
+
- **When it types.** No sooner than `--after` seconds (default 5), and only when the pane is idle and its prompt holds no typed text. It gives up after 30 minutes. The prompt is the text between the two rules of the input box; the background-agent panel below does not count (it presses Up out of that panel and clears the line with C-u first).
|
|
55
|
+
- **Busy.** A pane is busy only when "esc to interrupt" or "Waiting for" shows in the spinner line above the input box or in the footer below it (a turn that waits on background agents is busy). A chat line that starts with `●` or `⎿` never counts, so an agent that ends its turn with its own "Waiting for ..." text is idle.
|
|
56
|
+
- **Typed text.** After 2 minutes of it, and when it gives up, it sends one mailbox line to `<name>` and to each `--notify` agent. After 60 seconds, it saves the prompt to `.ethlete/restart.prompt.<session>.txt` and logs why in `.ethlete/restart.log`.
|
|
57
|
+
- **Who may restart whom.** Only your own session (from `$TMUX_PANE`) and the paired session (the builder started with `run --role builder`, or the non-builder session opposite it). Other targets are refused, and the error names your sender name. A restart of the paired session is logged as `peer restart: <caller> restarted <target>`.
|
|
58
|
+
- **Denied by permissions.** If the permission system denies your own `restart`, send one mailbox line to the grill/docs session, for example `send <you> --to <grill> 'restart denied, please /clear my pane and type: <prompt>'`. It types into your pane only when the pane is idle by the rule above.
|
|
59
|
+
- **Open questions.** For a `claude` session, `restart` reads the transcript and refuses while a chat line that starts with `❓` has no later message the human typed, unless the handoff the prompt resumes (`/handoff resume <name>`) names that question verbatim under "Open for the human". The refusal lists the questions to copy there.
|
|
60
|
+
|
|
61
|
+
`restart --process` ends the agent process instead of clearing it: it types `/exit` (`/quit` for a `codex` name) and starts the agent command again in the same tmux pane, through a login shell, with the prompt as its first message. It also stops the background shells and agents. Use it only after a change to an installed plugin, a settings file, an MCP server or `PATH`, use `--process`. The agent command is the one `run` started, without its prompt. It starts with `command`, so the shell function of the same name does not start a new session. If the exit opens the background work dialog, it selects "exit and stop tasks" and writes the stopped jobs to `restart.log` and a mailbox notice.
|
|
62
|
+
|
|
63
|
+
The new process takes the target's role, not the caller's: `--role`, else a resumed `builder-*` or `doc-agent-*` handoff's (`doc-agent-*` is none), else its own. A builder process gets `ETHLETE_AGENT_ROLE=builder` and, for `claude`, the builder system prompt once. A session with no role next to another agent session in the repo, none of them a builder, is refused unless the prompt resumes a `builder-*` or `doc-agent-*` handoff or `--role` is passed (`--role none` restarts it without a role).
|
|
64
|
+
|
|
65
|
+
Use `restart <name> --process --config ~/.claude-second <prompt...>` to save a new `CLAUDE_CONFIG_DIR` for the target and resume the handoff with its resolved role. Without `--config`, the process restart still refuses a saved config that differs from the calling agent's config.
|
|
66
|
+
|
|
67
|
+
`shell-install` writes one shell function per agent into `~/.zshrc` or `~/.bashrc`, between two marker lines. A second run replaces the block, and `--remove` deletes it. Use `--file` for another startup file and `--dry-run` to preview. After a new terminal opens, typing `claude` or `codex` in a repo with this skill runs the agent through `run`. Elsewhere the function starts the plain command. Run `shell-install` only when the user asks: it changes a file the user owns. `shell-init` prints the same functions without writing a file.
|
|
68
|
+
|
|
69
|
+
Choose a `<name>` that no other agent uses, for example `agent-a` or `agent-b`. Two sessions with one name look like one agent.
|
|
70
|
+
|
|
71
|
+
## Messages
|
|
72
|
+
|
|
73
|
+
The mailbox file is `.ethlete/mailbox.jsonl` in the git root. The first write also creates `.ethlete/.gitignore`, so the file stays out of git. Set `AGENT_MAILBOX` to use another path. For two Claude Code sessions, the `SendMessage` tool is the better channel. The mailbox is for agents that cannot reach each other directly.
|
|
74
|
+
|
|
75
|
+
An idle agent cannot read the mailbox. One `dispatch` process outside every agent fixes this. It polls the mailbox for free. When a message carries `--to <agent>`, it waits a short grace period and then, if the agent has not read the message, types the unread messages addressed to it into the `tmux` session `<agent>@<repo>`, or a session named only `<agent>` whose pane runs in this checkout, one line each as `Mailbox message from <sender>: <text>` with newlines collapsed. It never types a message from before the dispatcher started. Once the agent has run `inbox`, the wake marks them read as `inbox` does; until then `inbox` still lists them. The agent acts on them. A message without `--to` wakes nobody and is never typed. The dispatcher never types into a session of another checkout, and `send --to <agent>` refuses with a non-zero exit when no such session of this checkout runs.
|
|
76
|
+
|
|
77
|
+
If the prompt of the agent holds typed text, the dispatcher waits until that text is sent or cleared. It checks again every 2 seconds. An open menu, for example a permission dialog, also makes it wait. If the agent is in the middle of a turn, the wake-up line waits as its next prompt. An agent in a `tmux` session does not need the `--wait` loop, which costs a turn at every timeout. If you wait for an answer in a session without `tmux`, run `inbox <name> --wait 120`: it blocks until a message arrives or 120 seconds pass. If it prints "No new messages.", run it again. A background `--wait` ends after one message, so it is not a lasting watch.
|
|
78
|
+
|
|
79
|
+
- `inbox` keeps one cursor per sender name, so it never repeats a message. The first call shows the last 20.
|
|
80
|
+
- `read` shows the last 20 messages. Use `--all` for the full history.
|
|
81
|
+
- `send` with no message reads it from standard input, so a long message needs no shell quoting.
|
|
82
|
+
- `watch` is optional. It runs until you stop it. In Claude Code, start it with the `Monitor` tool, so a new message wakes the session. Without such a feature, rely on `inbox`.
|
|
83
|
+
- Never rewrite or truncate the file. Only the script appends to it.
|
|
84
|
+
- Keep credentials and personal data out of the mailbox.
|
|
85
|
+
|
|
86
|
+
## Claims
|
|
87
|
+
|
|
88
|
+
1. At the start of a task, run `claims` and `inbox`. They show what other agents hold and said.
|
|
89
|
+
2. Before you edit a file, run `claim` with the exact paths. A directory path claims everything below it. `claim` also prints the messages you have not seen yet.
|
|
90
|
+
3. If `claim` reports a conflict, do not edit. Run `send` to ask the holder for a handoff, then wait.
|
|
91
|
+
4. After each larger step, run `inbox` again. Most agents cannot wake on new output, so you must pull messages yourself.
|
|
92
|
+
5. When you finish, run `release`. A claim also expires after 4 hours, or after `--ttl` hours.
|
|
93
|
+
|
|
94
|
+
In this repo commit with `yarn commit -m "..." -- <paths>`: it adds untracked paths and waits for `.git/index.lock`. The hook lints staged files; typecheck and most specs run later.
|
|
95
|
+
|
|
96
|
+
A claim is advisory, not a lock. `--force` claims over another agent: use it only after the holder agreed. Silence is not approval. Acknowledge each handoff in words. No agent starts automatically. The user starts each one.
|
|
97
|
+
|
|
98
|
+
## Stop own processes
|
|
99
|
+
|
|
100
|
+
`stop-own [--dry-run]` stops what a session leaves behind, with no raw `kill`: processes that carry the caller's `CLAUDE_PID` but are reparented (no longer below that Claude process), and orphans of a dead session whose cwd lies in this checkout or its scratch dir, each with its whole subtree. Background tasks still attached to a live Claude process always stay: stop those with TaskStop first. Subagents share their session's `CLAUDE_PID`, so a process below the live session is never touched, and a reparented process counts as own only when its `ET_AGENT_ID` (stamped on every subagent Bash call by the `background-design-commands` hook) equals the caller's: a subagent never stops a sibling's runs, and the main session never stops a subagent's. `--dry-run` lists without signalling; otherwise SIGTERM, up to 5 s, then SIGKILL. Linux only, same uid.
|