@ethlete/agent-rules 0.1.0-next.42 → 0.1.0-next.44
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 +2 -2
- package/CHANGELOG.md +35 -0
- package/README.md +1 -18
- package/THIRD-PARTY-LICENSES.md +3 -3
- package/content/hooks/design-live-check.py +136 -0
- package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +1 -1
- package/content/mods/plugins/status-line/.claude-plugin/plugin.json +1 -1
- package/content/skills/agent-sessions/agent-sessions.mjs +37 -18
- package/content/skills/codex-subagent/SKILL.md +5 -7
- package/content/skills/codex-subagent/codex-agent.mjs +1 -1
- package/content/skills/design-exploration/SKILL.md +49 -36
- package/content/skills/design-exploration/reference-check-and-notes.md +5 -1
- package/content/skills/design-exploration/reference-flows.md +38 -0
- package/content/skills/design-exploration/reference-order-and-design-system.md +14 -24
- package/content/skills/design-exploration/reference-products-and-sketches.md +17 -1
- package/content/skills/domain-modeling/SKILL.md +13 -22
- package/content/skills/grill-with-docs/SKILL.md +1 -1
- package/package.json +1 -1
- package/src/lib/config.d.ts +0 -7
- package/src/lib/config.js +2 -3
- package/src/lib/config.js.map +1 -1
- package/src/lib/targets/hooks-shared.js +6 -12
- package/src/lib/targets/hooks-shared.js.map +1 -1
- package/content/hooks/away-mode.py +0 -287
- package/content/hooks/builder-chat-words.py +0 -269
- package/content/skills/design-exploration/reference-flows-and-wireframes.md +0 -78
- package/content/skills/domain-modeling/ADR-FORMAT.md +0 -48
|
@@ -2,41 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## The order of a design
|
|
4
4
|
|
|
5
|
-
A product design runs in this order. Each stage settles in calls before the next starts, and
|
|
6
|
-
each stage draws with what the stages before it settled
|
|
5
|
+
A product design runs in this order, after the first real screen of a new product (see `SKILL.md`), which draws its own colours, type and parts first. Each stage settles in calls before the next starts, and
|
|
6
|
+
each stage draws with what the stages before it settled:
|
|
7
7
|
|
|
8
|
-
1. **
|
|
9
|
-
in a product, draw them with the wireframe kit, see "Draw a wireframe"). They show
|
|
10
|
-
which components the product needs, not how they look. The stage ends with an inventory in
|
|
11
|
-
the wireframe call: every part the wireframes need, each mapped to the SDK component it
|
|
12
|
-
starts from, or marked new with the component call that draws it. The inventory is the
|
|
13
|
-
queue of component calls:
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
inventory: [
|
|
17
|
-
{ part: 'Search field', sdk: 'et-input' },
|
|
18
|
-
{ part: 'Match card', new: true, call: 'tomflix/components/match-card' },
|
|
19
|
-
],
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
2. **Foundations**: colours, colour themes and surface themes (the project's `themes` in
|
|
8
|
+
1. **Foundations**: colours, colour themes and surface themes (the project's `themes` in
|
|
23
9
|
`config.json`), plus the type scale, spacing and radius.
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
2. **Logo and CI**, if the project needs them. A logo sketch variant shows only the mark at one size; the six sections
|
|
11
|
+
(anatomy, clear space, minimum size, colour variants, misuse, motion) come after the merge of the picked variant.
|
|
12
|
+
3. **Components**, from the SDK ones rendered with `ng()`, themed and set up for the project.
|
|
26
13
|
Each accepted one becomes a design-system entry.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
4. **Larger elements**: the shell, the navigation, headers, lists, built from the entries.
|
|
15
|
+
5. **Pages**, built from the elements and the entries.
|
|
16
|
+
6. **The working prototype**: the pages joined with `ngStates` and `flow.on`.
|
|
30
17
|
|
|
31
18
|
Do not start a stage before the one above it is settled, and do not draw a page from parts that
|
|
32
19
|
are not in the design system. If the user asks for a later stage first, say which earlier stage
|
|
33
20
|
is missing, and draw that first.
|
|
34
21
|
|
|
35
|
-
The stages map onto the layers of a product:
|
|
22
|
+
The stages map onto the layers of a product: foundations, components, elements, pages. A settled
|
|
36
23
|
Legacy call with a stage counts for that stage in this order.
|
|
37
24
|
|
|
38
25
|
A later stage can show that an earlier one is incomplete. If a page needs a part that the system
|
|
39
|
-
does not have, add it to the
|
|
26
|
+
does not have, add it to the components queue. A part becomes a component only when at least two hosts
|
|
40
27
|
draw the same case. Until then it stays in the one element or page that draws it. When a second
|
|
41
28
|
host draws it, open a component sketch, and list in its brief every host and every case each one
|
|
42
29
|
draws, so the component covers them all.
|
|
@@ -49,6 +36,9 @@ not a component.
|
|
|
49
36
|
When each of several cases is drawn at rest and in the same interactions, build the states and their grid with
|
|
50
37
|
`interactionRows(rows, { interactions: ['hover', 'active'], force: (props, interaction) => ({ ...props, interaction }) })`
|
|
51
38
|
from `@design-system` and spread the result into `definePart`; never write those states and the grid by hand.
|
|
39
|
+
Draw the interactions once, on the first row. A row that only changes content, such as a badge, a longer title or a
|
|
40
|
+
missing logo, is drawn only at rest: name it in `restOnly: ['series']`. `sketch ready` refuses a content row whose
|
|
41
|
+
interactions look the same as the first row's as `INTERACTION-REPEAT`.
|
|
52
42
|
`sketch check` prints `grid <rows> x <columns> ok`, or the states the grid leaves out; a state in two cells
|
|
53
43
|
fails it as `GRID`, in `design check` too.
|
|
54
44
|
Interaction states (a state name whose last word is hover, focus, pressed, active or selected, such as `row-hover`) live only on a control
|
|
@@ -76,6 +76,16 @@ draw that first.
|
|
|
76
76
|
A section of an app is a page under `pages/`, never a state of the shell. An element holds its
|
|
77
77
|
own chrome only. A sketch on an element adds no state whose difference is page content in a slot.
|
|
78
78
|
|
|
79
|
+
The variants of a composition (an element or a page) differ only in arrangement and use the same
|
|
80
|
+
sub-parts. A sub-part the composition needs (a tab bar, a search field) is a part of its own under
|
|
81
|
+
`components/`: open a sketch on it and import it as `@system/components/<name>`. `sketch check` and
|
|
82
|
+
`design check` fail a composition whose variants hold different copies of a part they import. While
|
|
83
|
+
that sub-part is new in its open sketch, record the variant you recommend with
|
|
84
|
+
`sketch recommend <layer>/<name> --variant <key> --by <model id>`: every sketch that imports it
|
|
85
|
+
draws that variant, or the user's pick once there is one, with no hint in Studio. The composition
|
|
86
|
+
cannot merge before the sub-part does; the merge of the sub-part rebases the composition sketch onto
|
|
87
|
+
the merged part.
|
|
88
|
+
|
|
79
89
|
A variant mirrors the product layout and holds only the parts it changes. Draw two to four
|
|
80
90
|
variants, each with what it costs, and run `sketch check` before `ready`. A variant with problems
|
|
81
91
|
cannot be picked. A part in a variant keeps every state the part has in the product: `sketch check`
|
|
@@ -128,7 +138,9 @@ import { flows } from '@shared/flow-data';
|
|
|
128
138
|
An asset (a mark, logo, icon, picture or font) is one file in `.ethlete/design/<product>/assets/`,
|
|
129
139
|
never a copy inlined into parts. A part imports it as `@assets/<file>`: the default import is a URL
|
|
130
140
|
for `<img src>`; an SVG that must follow tokens (`currentColor`, `var(--accent)`) imports with
|
|
131
|
-
`?raw` and goes inline, for example `@assets/icons/<name>.svg?raw`. A
|
|
141
|
+
`?raw` and goes inline, for example `@assets/icons/<name>.svg?raw`. A picture with the title baked in
|
|
142
|
+
(a poster, key art) gets `data-et-carries-title` on its `<img>`; `sketch check` warns when a heading or an
|
|
143
|
+
`<img>` with alt text draws the title again next to it. A backdrop without the title gets no marker. A stylesheet, the product's
|
|
132
144
|
`styles.css` or a part's, uses `url('@assets/<file>')`, for example in an `@font-face`. A foundation
|
|
133
145
|
part may wrap an asset in a named export. A product finds its base product's assets too. A sketch
|
|
134
146
|
variant adds or changes an asset in its own `<variant>/assets/` folder (`sketch new` and `sketch variant`
|
|
@@ -184,6 +196,10 @@ merge queue: ask first, make the change, then mark it `ready`. Record the wait w
|
|
|
184
196
|
`et design sketch hold <layer>/<name> --until "<what it waits on>" --by <model id>` (a `ready` sketch goes back
|
|
185
197
|
in progress) and `sketch release` it once the change is in.
|
|
186
198
|
|
|
199
|
+
The pick of another sketch is not a wait. A sketch that uses a part another open sketch changes draws that part
|
|
200
|
+
as merged now, and goes `ready`. When the user merges the other sketch, the next design commit rebases this one.
|
|
201
|
+
A hold on it leaves the user nothing to choose until the other pick.
|
|
202
|
+
|
|
187
203
|
### Your model id: `--by`
|
|
188
204
|
|
|
189
205
|
Every command that writes takes `--by <model id>` and fails without it: `sketch new`, `variant`, `report`,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: domain-modeling
|
|
3
|
-
description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording
|
|
3
|
+
description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a CONTEXT.md, or recording a design decision.
|
|
4
4
|
kind: skill
|
|
5
5
|
scope: both
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Domain Modeling
|
|
9
9
|
|
|
10
|
-
Actively build and sharpen the project's domain model as you design. This is the _active_ discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions
|
|
10
|
+
Actively build and sharpen the project's domain model as you design. This is the _active_ discipline: challenging terms, inventing edge-case scenarios, and writing the glossary down and turning decisions into tests the moment they crystallise. (Merely _reading_ `CONTEXT.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
|
|
11
11
|
|
|
12
12
|
## File structure
|
|
13
13
|
|
|
@@ -16,10 +16,6 @@ Most repos have a single context:
|
|
|
16
16
|
```
|
|
17
17
|
/
|
|
18
18
|
├── CONTEXT.md
|
|
19
|
-
├── docs/
|
|
20
|
-
│ └── adr/
|
|
21
|
-
│ ├── 0001-event-sourced-orders.md
|
|
22
|
-
│ └── 0002-postgres-for-write-model.md
|
|
23
19
|
└── src/
|
|
24
20
|
```
|
|
25
21
|
|
|
@@ -28,18 +24,14 @@ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The ma
|
|
|
28
24
|
```
|
|
29
25
|
/
|
|
30
26
|
├── CONTEXT-MAP.md
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
│ │ └── docs/adr/ ← context-specific decisions
|
|
37
|
-
│ └── billing/
|
|
38
|
-
│ ├── CONTEXT.md
|
|
39
|
-
│ └── docs/adr/
|
|
27
|
+
└── src/
|
|
28
|
+
├── ordering/
|
|
29
|
+
│ └── CONTEXT.md
|
|
30
|
+
└── billing/
|
|
31
|
+
└── CONTEXT.md
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
Create files lazily: only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved.
|
|
34
|
+
Create files lazily: only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved.
|
|
43
35
|
|
|
44
36
|
## During the session
|
|
45
37
|
|
|
@@ -65,15 +57,14 @@ When a term is resolved, update `CONTEXT.md` right there. Don't batch these up:
|
|
|
65
57
|
|
|
66
58
|
`CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
|
|
67
59
|
|
|
68
|
-
###
|
|
60
|
+
### Record a decision as a test or a tool
|
|
69
61
|
|
|
70
|
-
|
|
62
|
+
Never write an ADR. A decision becomes one of these, in the same change:
|
|
71
63
|
|
|
72
|
-
1. **
|
|
73
|
-
2. **
|
|
74
|
-
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
64
|
+
1. **A test** that fails when the code goes against the decision, with a one-sentence comment that states the decision.
|
|
65
|
+
2. **A tool**: a live check that runs while the agent writes, or a generator for the base the agent then extends.
|
|
75
66
|
|
|
76
|
-
|
|
67
|
+
A decision that fits neither is not settled yet: keep asking. Existing ADRs stay until a cleanup pass turns each one into a test or deletes it.
|
|
77
68
|
|
|
78
69
|
---
|
|
79
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grill-with-docs
|
|
3
|
-
description: A relentless interview to sharpen a plan or design, which also
|
|
3
|
+
description: A relentless interview to sharpen a plan or design, which also updates the glossary and turns each decision into a test as we go.
|
|
4
4
|
kind: skill
|
|
5
5
|
scope: both
|
|
6
6
|
modelInvocation: false
|
package/package.json
CHANGED
package/src/lib/config.d.ts
CHANGED
|
@@ -36,12 +36,6 @@ export type SyncConfig = {
|
|
|
36
36
|
jira: JiraSettings;
|
|
37
37
|
configWarnings?: string[];
|
|
38
38
|
};
|
|
39
|
-
/** Opt-in settings of the `away-mode` hook: the skills whose sessions it tracks, the idle threshold, and the command printing the report table on return. */
|
|
40
|
-
export type AwayModeConfig = {
|
|
41
|
-
skills?: string[];
|
|
42
|
-
thresholdMinutes?: number;
|
|
43
|
-
reportCommand?: string;
|
|
44
|
-
};
|
|
45
39
|
/** Opt-in settings of `ethlete-agents report`: repo-relative paths of the markdown files holding row tables and the queue. */
|
|
46
40
|
export type ReportConfig = {
|
|
47
41
|
planFiles?: string[];
|
|
@@ -70,7 +64,6 @@ export declare const readReportConfig: (root: string) => ReportConfig;
|
|
|
70
64
|
export type LocalConfig = {
|
|
71
65
|
disableHooks?: boolean | string[];
|
|
72
66
|
disableAutoHandoffSave?: boolean;
|
|
73
|
-
awayMode?: AwayModeConfig;
|
|
74
67
|
};
|
|
75
68
|
export type LocalConfigState = {
|
|
76
69
|
exists: false;
|
package/src/lib/config.js
CHANGED
|
@@ -33,7 +33,6 @@ const RAW_CONFIG_KEYS = [
|
|
|
33
33
|
'mods',
|
|
34
34
|
'gitFlow',
|
|
35
35
|
'jira',
|
|
36
|
-
'awayMode',
|
|
37
36
|
'report',
|
|
38
37
|
];
|
|
39
38
|
const parseJson = (text) => {
|
|
@@ -47,7 +46,7 @@ const parseJson = (text) => {
|
|
|
47
46
|
const assertConfigShapes = (value) => {
|
|
48
47
|
var _a;
|
|
49
48
|
const arrays = ['exclude', 'hooks', 'gitHooks', 'mods'];
|
|
50
|
-
const objects = ['vars', 'gitFlow', 'jira', '
|
|
49
|
+
const objects = ['vars', 'gitFlow', 'jira', 'report'];
|
|
51
50
|
for (const key of arrays) {
|
|
52
51
|
const entry = value[key];
|
|
53
52
|
if (entry !== undefined && (!Array.isArray(entry) || entry.some((item) => typeof item !== 'string'))) {
|
|
@@ -102,7 +101,7 @@ const unknownConfigKeyWarnings = (raw) => {
|
|
|
102
101
|
]
|
|
103
102
|
: [];
|
|
104
103
|
};
|
|
105
|
-
exports.LOCAL_CONFIG_KEYS = ['disableHooks', 'disableAutoHandoffSave'
|
|
104
|
+
exports.LOCAL_CONFIG_KEYS = ['disableHooks', 'disableAutoHandoffSave'];
|
|
106
105
|
/**
|
|
107
106
|
* Repo topology moved to `@ethlete/cli`'s `ethlete.config.local.json`, because `et` needs it too.
|
|
108
107
|
* Still recognised here so a checkout that has not moved them yet gets told where they went
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/config.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAAqC;AACrC,6CAAuE;AAEvE,yCAAmF;AACnF,iDAAiD;AACjD,qDAAgG;AAEnF,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAIlE,QAAA,gBAAgB,GAAG,4BAA4B,CAAC;AAEhD,QAAA,sBAAsB,GAAG,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/config.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAAqC;AACrC,6CAAuE;AAEvE,yCAAmF;AACnF,iDAAiD;AACjD,qDAAgG;AAEnF,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAIlE,QAAA,gBAAgB,GAAG,4BAA4B,CAAC;AAEhD,QAAA,sBAAsB,GAAG,kCAAkC,CAAC;AAuDzE,uGAAuG;AAChG,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,OAAO,CAAC,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,OAAO,EAAE,wBAAgB,CAAC,CAAC,EAAE,CAAC;QACpD,MA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|
34
|
-
events: [{ event: 'UserPromptSubmit' }],
|
|
35
|
-
file: 'away-mode.py',
|
|
36
|
-
timeout: 10,
|
|
37
|
-
agents: ['claude'],
|
|
38
|
-
},
|
|
39
33
|
'background-design-commands': {
|
|
40
34
|
events: [{ event: 'PreToolUse', matcher: 'Bash' }],
|
|
41
35
|
file: 'background-design-commands.py',
|
|
42
36
|
timeout: 10,
|
|
43
37
|
agents: ['claude'],
|
|
44
38
|
},
|
|
39
|
+
'design-live-check': {
|
|
40
|
+
events: [{ event: 'PostToolUse', matcher: 'Edit|Write|MultiEdit' }],
|
|
41
|
+
file: 'design-live-check.py',
|
|
42
|
+
timeout: 60,
|
|
43
|
+
agents: ['claude'],
|
|
44
|
+
},
|
|
45
45
|
'git-safety': {
|
|
46
46
|
events: [{ event: 'PreToolUse', matcher: 'Bash' }],
|
|
47
47
|
file: 'git-safety.py',
|
|
48
48
|
timeout: 10,
|
|
49
49
|
agents: ['claude'],
|
|
50
50
|
},
|
|
51
|
-
'builder-chat-words': {
|
|
52
|
-
events: [{ event: 'Stop' }],
|
|
53
|
-
file: 'builder-chat-words.py',
|
|
54
|
-
timeout: 10,
|
|
55
|
-
agents: ['claude'],
|
|
56
|
-
},
|
|
57
51
|
};
|
|
58
52
|
/** Drops the hooks whose event the agent does not have, so neither script nor entry is emitted. */
|
|
59
53
|
const hooksForAgent = (options) => options.hooks.filter((name) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-shared.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/targets/hooks-shared.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAClC,+BAA4B;AAC5B,kDAAqD;AACrD,sCAAwC;AAmBxC;;;GAGG;AACU,QAAA,WAAW,GAAmC;IACzD,iBAAiB,EAAE;QACjB,MAAM,EAAE;YACN,EAAE,KAAK,EAAE,kBAAkB,EAAE;YAC7B,4EAA4E;YAC5E,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EA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CAAC;AAxBW,QAAA,gBAAgB,oBAwB3B"}
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""UserPromptSubmit hook: switch an interactive session into "user is away" mode on its own.
|
|
3
|
-
|
|
4
|
-
A session opts in through `awayMode` in ethlete-agents.config.json (the local config file
|
|
5
|
-
overrides it): {"awayMode": {"skills": ["doc-agent"], "thresholdMinutes": 15}}. Without `skills`
|
|
6
|
-
the hook does nothing. A session becomes active when a prompt starts with `/<skill>` or with
|
|
7
|
-
`/handoff resume <skill>-`.
|
|
8
|
-
|
|
9
|
-
Prompts the agent sessions send themselves (mailbox messages, cross-session messages, task
|
|
10
|
-
notifications, system reminders, the restart prompt) are not human input. The last human-typed
|
|
11
|
-
prompt is stored per session; when a non-human prompt arrives after the threshold, the hook injects
|
|
12
|
-
the away message once and a one-line reminder afterwards. The next human-typed prompt injects the
|
|
13
|
-
back message; with `awayMode.reportCommand` (e.g. `node dist/libs/agent-rules/src/index.js report`)
|
|
14
|
-
it also carries that command's table for the time away (`--since <last typed input>`), left out when the
|
|
15
|
-
command fails or takes over 10 s. A human prompt that is exactly `afk` marks the session away at once.
|
|
16
|
-
|
|
17
|
-
State lives in `<git common dir>/ethlete/away/<session_id>.json`, so it is never committed.
|
|
18
|
-
|
|
19
|
-
Can be disabled per machine via a gitignored ethlete-agents.config.local.json at the repo root:
|
|
20
|
-
{"disableHooks": true} or {"disableHooks": ["away-mode"]}.
|
|
21
|
-
|
|
22
|
-
Fail-safe: any error exits 0 with no output - the hook must never block work because it could
|
|
23
|
-
not read its own input.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
import json
|
|
27
|
-
import os
|
|
28
|
-
import re
|
|
29
|
-
import shlex
|
|
30
|
-
import subprocess
|
|
31
|
-
import sys
|
|
32
|
-
from datetime import datetime, timezone
|
|
33
|
-
|
|
34
|
-
HOOK_NAME = "away-mode"
|
|
35
|
-
CONFIG_FILE = "ethlete-agents.config.json"
|
|
36
|
-
LOCAL_CONFIG_FILE = "ethlete-agents.config.local.json"
|
|
37
|
-
DEFAULT_THRESHOLD_MINUTES = 15
|
|
38
|
-
AGENT_SESSIONS_SUFFIX = "[typed by agent-sessions]"
|
|
39
|
-
|
|
40
|
-
BACK_MESSAGE = (
|
|
41
|
-
"The user is back (typed input after {minutes} min away). Leave away mode: put every question you "
|
|
42
|
-
"collected while they were away once, in full, in your round format."
|
|
43
|
-
)
|
|
44
|
-
AWAY_MESSAGE = (
|
|
45
|
-
"The user is away (no typed input for {minutes} min). Work by your skill's away rules: collect "
|
|
46
|
-
"questions, one short line per event, no round. Typed input switches back on its own."
|
|
47
|
-
)
|
|
48
|
-
BACK_REPORT_MESSAGE = (
|
|
49
|
-
" Paste this report for the time away unchanged, then the collected questions:\n\n{report}"
|
|
50
|
-
)
|
|
51
|
-
REPORT_TIMEOUT_SECONDS = 10
|
|
52
|
-
STILL_AWAY_MESSAGE = "The user is still away (no typed input for {minutes} min)."
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def agent_name(argv):
|
|
56
|
-
"""The --agent value, defaulting to claude — older registrations pass no flag."""
|
|
57
|
-
for index, arg in enumerate(argv):
|
|
58
|
-
if arg == "--agent" and index + 1 < len(argv):
|
|
59
|
-
return argv[index + 1]
|
|
60
|
-
if arg.startswith("--agent="):
|
|
61
|
-
return arg.split("=", 1)[1]
|
|
62
|
-
return "claude"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def repo_root(data):
|
|
66
|
-
"""Repo root: the env var the agent sets, else the script's own location, else the cwd."""
|
|
67
|
-
for variable in ("CLAUDE_PROJECT_DIR", "CODEX_PROJECT_DIR"):
|
|
68
|
-
value = os.environ.get(variable)
|
|
69
|
-
if value:
|
|
70
|
-
return value
|
|
71
|
-
here = os.path.abspath(__file__)
|
|
72
|
-
derived = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(here))))
|
|
73
|
-
if os.path.isfile(os.path.join(derived, LOCAL_CONFIG_FILE)):
|
|
74
|
-
return derived
|
|
75
|
-
cwd = data.get("cwd")
|
|
76
|
-
return cwd if isinstance(cwd, str) and cwd else derived
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def load_config(root, file_name):
|
|
80
|
-
"""Parsed JSON object at the repo root, or {} if missing/unreadable."""
|
|
81
|
-
if not root:
|
|
82
|
-
return {}
|
|
83
|
-
try:
|
|
84
|
-
with open(os.path.join(root, file_name), encoding="utf-8") as f:
|
|
85
|
-
config = json.load(f)
|
|
86
|
-
except (OSError, ValueError, AttributeError):
|
|
87
|
-
return {}
|
|
88
|
-
return config if isinstance(config, dict) else {}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def load_local_config(root):
|
|
92
|
-
return load_config(root, LOCAL_CONFIG_FILE)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def disabled_locally(config):
|
|
96
|
-
"""True when the local config disables this hook (or all hooks) on this machine."""
|
|
97
|
-
disabled = config.get("disableHooks")
|
|
98
|
-
return disabled is True or (isinstance(disabled, list) and HOOK_NAME in disabled)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def away_settings(root, local_config):
|
|
102
|
-
"""(skills, threshold in minutes); the local config's `awayMode` replaces the shared one."""
|
|
103
|
-
setting = local_config.get("awayMode")
|
|
104
|
-
if not isinstance(setting, dict):
|
|
105
|
-
setting = load_config(root, CONFIG_FILE).get("awayMode")
|
|
106
|
-
if not isinstance(setting, dict):
|
|
107
|
-
return [], DEFAULT_THRESHOLD_MINUTES
|
|
108
|
-
skills = setting.get("skills")
|
|
109
|
-
skills = [s for s in skills if isinstance(s, str) and s] if isinstance(skills, list) else []
|
|
110
|
-
threshold = setting.get("thresholdMinutes")
|
|
111
|
-
if isinstance(threshold, bool) or not isinstance(threshold, (int, float)) or threshold <= 0:
|
|
112
|
-
threshold = DEFAULT_THRESHOLD_MINUTES
|
|
113
|
-
return skills, threshold
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def report_command(root, local_config):
|
|
117
|
-
"""The configured report command; the local config's `awayMode` replaces the shared one."""
|
|
118
|
-
setting = local_config.get("awayMode")
|
|
119
|
-
if not isinstance(setting, dict):
|
|
120
|
-
setting = load_config(root, CONFIG_FILE).get("awayMode")
|
|
121
|
-
command = setting.get("reportCommand") if isinstance(setting, dict) else None
|
|
122
|
-
return command.strip() if isinstance(command, str) and command.strip() else None
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def away_report(root, command, since):
|
|
126
|
-
"""The report table since `since`, or None when the command is missing, fails or is too slow."""
|
|
127
|
-
if not command or not since:
|
|
128
|
-
return None
|
|
129
|
-
try:
|
|
130
|
-
result = subprocess.run(
|
|
131
|
-
shlex.split(command) + ["--since", since],
|
|
132
|
-
cwd=root,
|
|
133
|
-
capture_output=True,
|
|
134
|
-
text=True,
|
|
135
|
-
timeout=REPORT_TIMEOUT_SECONDS,
|
|
136
|
-
)
|
|
137
|
-
except Exception:
|
|
138
|
-
return None
|
|
139
|
-
output = result.stdout.strip()
|
|
140
|
-
return output if result.returncode == 0 and output else None
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def is_human_typed(prompt):
|
|
144
|
-
stripped = prompt.strip()
|
|
145
|
-
return not (
|
|
146
|
-
stripped.startswith("Mailbox message from ")
|
|
147
|
-
or "<cross-session-message" in stripped
|
|
148
|
-
or stripped.endswith(AGENT_SESSIONS_SUFFIX)
|
|
149
|
-
or stripped.startswith("<task-notification")
|
|
150
|
-
or stripped.startswith("<system-reminder")
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def invokes_skill(prompt, skills):
|
|
155
|
-
text = prompt.strip()
|
|
156
|
-
if text.endswith(AGENT_SESSIONS_SUFFIX):
|
|
157
|
-
text = text[: -len(AGENT_SESSIONS_SUFFIX)].strip()
|
|
158
|
-
for skill in skills:
|
|
159
|
-
name = re.escape(skill)
|
|
160
|
-
if re.match(rf"/{name}(?![\w-])", text) or re.match(rf"/handoff\s+resume\s+{name}-", text):
|
|
161
|
-
return True
|
|
162
|
-
return False
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
def state_path(root, session_id):
|
|
166
|
-
result = subprocess.run(
|
|
167
|
-
["git", "-C", root, "rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
168
|
-
capture_output=True,
|
|
169
|
-
text=True,
|
|
170
|
-
timeout=3,
|
|
171
|
-
)
|
|
172
|
-
common_dir = result.stdout.strip() if result.returncode == 0 else ""
|
|
173
|
-
if not common_dir:
|
|
174
|
-
return None
|
|
175
|
-
safe_id = re.sub(r"[^\w.-]", "_", str(session_id))
|
|
176
|
-
return os.path.join(common_dir, "ethlete", "away", f"{safe_id}.json")
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def read_state(path):
|
|
180
|
-
try:
|
|
181
|
-
with open(path, encoding="utf-8") as f:
|
|
182
|
-
state = json.load(f)
|
|
183
|
-
except (OSError, ValueError):
|
|
184
|
-
return None
|
|
185
|
-
return state if isinstance(state, dict) else None
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def write_state(path, state):
|
|
189
|
-
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
190
|
-
with open(path, "w", encoding="utf-8") as f:
|
|
191
|
-
json.dump(state, f)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
def minutes_since(iso, now):
|
|
195
|
-
try:
|
|
196
|
-
then = datetime.fromisoformat(iso)
|
|
197
|
-
except (TypeError, ValueError):
|
|
198
|
-
return None
|
|
199
|
-
if then.tzinfo is None:
|
|
200
|
-
then = then.replace(tzinfo=timezone.utc)
|
|
201
|
-
return max(0, int((now - then).total_seconds() // 60))
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
def emit(message):
|
|
205
|
-
print(
|
|
206
|
-
json.dumps(
|
|
207
|
-
{"hookSpecificOutput": {"hookEventName": "UserPromptSubmit", "additionalContext": message}}
|
|
208
|
-
)
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def main():
|
|
213
|
-
if agent_name(sys.argv[1:]) != "claude":
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
data = json.load(sys.stdin)
|
|
217
|
-
prompt = data.get("prompt")
|
|
218
|
-
session_id = data.get("session_id")
|
|
219
|
-
|
|
220
|
-
if not isinstance(prompt, str) or not session_id:
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
root = repo_root(data)
|
|
224
|
-
local_config = load_local_config(root)
|
|
225
|
-
|
|
226
|
-
if disabled_locally(local_config):
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
skills, threshold = away_settings(root, local_config)
|
|
230
|
-
|
|
231
|
-
if not skills:
|
|
232
|
-
return
|
|
233
|
-
|
|
234
|
-
path = state_path(root, session_id)
|
|
235
|
-
|
|
236
|
-
if not path:
|
|
237
|
-
return
|
|
238
|
-
|
|
239
|
-
now = datetime.now(timezone.utc)
|
|
240
|
-
now_iso = now.isoformat(timespec="seconds")
|
|
241
|
-
state = read_state(path)
|
|
242
|
-
human = is_human_typed(prompt)
|
|
243
|
-
|
|
244
|
-
if not state or not state.get("active"):
|
|
245
|
-
if not invokes_skill(prompt, skills):
|
|
246
|
-
return
|
|
247
|
-
state = {"active": True, "lastHumanInput": now_iso if human else None, "away": False}
|
|
248
|
-
write_state(path, state)
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
if human:
|
|
252
|
-
was_away = state.get("away") is True
|
|
253
|
-
since = state.get("lastHumanInput")
|
|
254
|
-
minutes = minutes_since(since, now)
|
|
255
|
-
state["lastHumanInput"] = now_iso
|
|
256
|
-
state["away"] = prompt.strip().lower() == "afk"
|
|
257
|
-
write_state(path, state)
|
|
258
|
-
if was_away and not state["away"]:
|
|
259
|
-
message = BACK_MESSAGE.format(minutes=minutes if minutes is not None else threshold)
|
|
260
|
-
report = away_report(root, report_command(root, local_config), since)
|
|
261
|
-
if report:
|
|
262
|
-
message += BACK_REPORT_MESSAGE.format(report=report)
|
|
263
|
-
emit(message)
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
minutes = minutes_since(state.get("lastHumanInput"), now)
|
|
267
|
-
|
|
268
|
-
if minutes is not None and minutes < threshold:
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
shown = minutes if minutes is not None else int(threshold)
|
|
272
|
-
|
|
273
|
-
if state.get("away") is True:
|
|
274
|
-
emit(STILL_AWAY_MESSAGE.format(minutes=shown))
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
state["away"] = True
|
|
278
|
-
write_state(path, state)
|
|
279
|
-
emit(AWAY_MESSAGE.format(minutes=shown))
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if __name__ == "__main__":
|
|
283
|
-
try:
|
|
284
|
-
main()
|
|
285
|
-
except Exception:
|
|
286
|
-
pass
|
|
287
|
-
sys.exit(0)
|