@ethlete/agent-rules 0.1.0-next.33 → 0.1.0-next.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ethlete/agent-rules
2
2
 
3
+ ## 0.1.0-next.34
4
+
5
+ ### Minor Changes
6
+
7
+ - `app-styling` allows app CSS in `@layer components` again, and `et update` no longer leaves the `app-styling-utilities` task.
8
+
9
+ ### Patch Changes
10
+
11
+ - The git-safety hook now allows the commit that concludes a merge when a plan archive under `plans/**/archive/` is staged next to the merge paths, so an archive run that shrinks a merged plan can go into the merge commit.
12
+ - `agent-sessions restart` refuses while a `❓` question of a Claude session has no later human message, unless the resumed handoff names it under "Open for the human".
13
+ - The `background-design-commands` hook lets a `--help` or `-h` call of a long `design` command run in the foreground; `studio:e2e --help` stays denied because it runs the suite.
14
+ - The agent-sessions `restart` and wake-up commands now see a focused footer pill or agent panel row of the current Claude Code build, and move the focus back to the prompt before they type.
15
+ - Tighten the agent-sessions skill, mainly the restart section.
16
+ - The agent-sessions skill starts each agent with `CLAUDE_CODE_TMPDIR=~/.cache/claude-tmp`, in `run`, the shell functions and `restart --process`, so a full `/tmp` does not stop the agent's shell.
17
+ - Remove `et design check --visible-change` and the `harness.baseBranch` setting it read; `et design compare --base <rev>` still compares against a clone at `<rev>`. The `background-design-commands` hook no longer names `--visible-change`.
18
+ - Tighten the timetrack skill and list transcript and resync in its command table.
19
+
3
20
  ## 0.1.0-next.33
4
21
 
5
22
  ### Minor Changes
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env python3
2
2
  """PreToolUse hook: long design commands must run in the background.
3
3
 
4
- `design check`, `design compare`, `design ready`, `design sketch ready`, `design harness`,
5
- the `studio:e2e` target and the `--visible-change` gate each take minutes. In the foreground
4
+ `design check`, `design compare`, `design ready`, `design sketch ready`, `design harness`
5
+ and the `studio:e2e` target each take minutes. A `--help` or `-h`
6
+ call of a `design` command only prints usage and passes; `studio:e2e --help` runs the suite. In the foreground
6
7
  they block the whole session, so a Bash call that runs one without `run_in_background: true`
7
8
  is denied and the agent repeats it in the background.
8
9
 
@@ -32,7 +33,6 @@ LONG_COMMANDS = (
32
33
  ("design sketch ready", re.compile(r"\bdesign\s+sketch\s+ready(?=\s|$)")),
33
34
  ("design harness", re.compile(r"\bdesign\s+harness(?=\s|$)")),
34
35
  ("studio:e2e", re.compile(r"studio:e2e(?=\s|$|:)")),
35
- ("--visible-change", re.compile(r"(?:^|\s)--visible-change(?=\s|=|$)")),
36
36
  )
37
37
 
38
38
  LAUNCHERS = frozenset(
@@ -43,6 +43,8 @@ QUOTED = re.compile(r"\"(?:\\.|[^\"\\])*\"|'[^']*'")
43
43
  HEREDOC = re.compile(r"<<-?\s*(?:\"(\w+)\"|'(\w+)'|\\?(\w+))")
44
44
  SEPARATORS = re.compile(r"&&|\|\||[;&|\n(){}`]")
45
45
  ASSIGNMENT = re.compile(r"^[A-Za-z_]\w*=")
46
+ HELP_PRINTS_USAGE = frozenset(("design check", "design compare", "design ready", "design sketch ready", "design harness"))
47
+ HELP_FLAG = re.compile(r"(?:^|\s)(?:--help|-h)(?=\s|$)")
46
48
 
47
49
 
48
50
  def without_heredoc_bodies(command):
@@ -117,7 +119,7 @@ def long_command_in(command):
117
119
  if not at_command_position(segment):
118
120
  continue
119
121
  for name, pattern in LONG_COMMANDS:
120
- if pattern.search(segment):
122
+ if pattern.search(segment) and not (name in HELP_PRINTS_USAGE and HELP_FLAG.search(segment)):
121
123
  return name
122
124
  return None
123
125
 
@@ -7,7 +7,8 @@ Denies, for a Bash call:
7
7
  `create`, `store`); `git stash list` and `git stash show` stay allowed
8
8
  - `git commit --amend`
9
9
  - `git commit` without a ` -- <paths>` pathspec, except the commit that concludes a merge: while
10
- `MERGE_HEAD` exists and every staged path changed between HEAD and MERGE_HEAD or is conflicted
10
+ `MERGE_HEAD` exists and every staged path changed between HEAD and MERGE_HEAD, is conflicted, or is a
11
+ plan archive under `plans/**/archive/` (an archive run that shrinks a merged plan writes there)
11
12
 
12
13
  `git commit-tree` and `git update-index` stay allowed, so a merge commit built on a temporary
13
14
  GIT_INDEX_FILE works. Only real command positions count: commit messages (`-m`, `--message`), quoted text and heredoc
@@ -119,11 +120,15 @@ def concludes_merge(cwd):
119
120
  merge_paths = git_lines(cwd, "diff", "--name-only", "HEAD", "MERGE_HEAD") | git_lines(
120
121
  cwd, "diff", "--name-only", "--diff-filter=U"
121
122
  )
122
- return staged <= merge_paths
123
+ return all(path in merge_paths or is_plan_archive(path) for path in staged)
123
124
  except Exception:
124
125
  return False
125
126
 
126
127
 
128
+ def is_plan_archive(path):
129
+ return path.startswith("plans/") and "/archive/" in path
130
+
131
+
127
132
  def stages_everything(args):
128
133
  return any(arg == "--all" or re.fullmatch(r"-[a-zA-Z]*a[a-zA-Z]*", arg) for arg in args if arg != "--")
129
134
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "e2e-progress",
3
- "version": "0.1.0-next.33",
3
+ "version": "0.1.0-next.34",
4
4
  "description": "Live Playwright e2e progress from a run log, as a status line entry and a pane",
5
5
  "types": "./types/index.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: app-styling
3
- description: App components are styled with Tailwind utilities in their templates; app CSS stays out of @layer components; the SDK needs a 10px rem root; hardcoded colours are never primary values.
3
+ description: App components are styled with Tailwind utilities in their templates; app CSS goes in @layer components, @layer utilities or unlayered; the SDK needs a 10px rem root; hardcoded colours are never primary values.
4
4
  kind: rule
5
5
  scope: consumer
6
6
  requires: ['@ethlete/core']
@@ -31,12 +31,12 @@ tell the user once at first contact, with the size of the conversion (files, cla
31
31
  colours), and record it as owed work in the plan or handoff. Never skip it silently. This holds
32
32
  for a deviation from any rule here: report it once and record it.
33
33
 
34
- Write CSS only for what utilities cannot express. With Tailwind 4, keep that CSS **unlayered**
35
- or in `@layer utilities` — never in `@layer components`, and that includes the global
36
- stylesheet. SDK component styles are injected into `@layer components` at runtime, after your
37
- stylesheet, so an app rule in the same layer ties on layer and loses on source order. With
38
- Tailwind 3, `@layer` is a Tailwind directive that emits unlayered CSS, so app CSS already beats
39
- the SDK's layered styles.
34
+ Write CSS only for what utilities cannot express. With Tailwind 4, put that CSS in
35
+ `@layer components`, `@layer utilities` or leave it unlayered: SDK component styles sit in
36
+ `@layer components.sdk`, a layer nested in `components`, so each of the three beats them. In
37
+ `@layer components` a utility on the same element still wins over the app rule. With Tailwind
38
+ 3, `@layer` is a Tailwind directive that emits unlayered CSS, so app CSS already beats the
39
+ SDK's layered styles.
40
40
 
41
41
  To change an SDK component's look, set its `--et-*` tokens first (documented per
42
42
  component), then use a utility class or unlayered CSS on the element — see "Overriding
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: styling
3
- description: Component CSS is plain CSS in @layer components, and hardcoded colours are never primary values.
3
+ description: Component CSS is plain CSS in @layer components.sdk, and hardcoded colours are never primary values.
4
4
  kind: rule
5
5
  scope: sdk
6
6
  requires: ['@ethlete/core']
@@ -13,13 +13,15 @@ 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 one
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
@@ -45,13 +45,22 @@ Nothing runs until you start it, so a person who does not use this does nothing.
45
45
 
46
46
  ## Sessions
47
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. 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. `--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. `--dry-run` prints the command instead of starting it. So a second `claude` terminal gets its own agent.
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. 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. `--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. So a second `claude` terminal gets its own agent.
49
49
 
50
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
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>`, no sooner than `--after` seconds (default 5). It waits until that session ended its turn and its prompt holds no typed text, and gives up after 30 minutes. After the clear, a new turn does not hold the prompt back: a message can wake the fresh session, and Claude Code queues input typed during a turn. Only typed text in its prompt holds the prompt back. The prompt is the text between the two rules of the input box, so the background-agent panel below the footer does not count as typed text. When the focus sits in that panel, it presses Up until the prompt has the focus and clears the line with C-u before it types. After 2 minutes of typed text, and when it gives up, it sends one mailbox line to `<name>` and to each `--notify` agent. After 60 seconds of typed text, it saves the prompt to `.ethlete/restart.prompt.<session>.txt` and logs why in `.ethlete/restart.log`. The command returns at once, so end your turn after it. An agent uses it to clear itself and resume from its saved work state. It refuses any session other than the caller's own (from `$TMUX_PANE`) and the paired session (the builder session, started with `run --role builder`, and any session that is not one), and the error names the caller's own sender name. A restart of the paired session is logged to `restart.log` as `peer restart: <caller> restarted <target>`. Background commands of the old session still report into the new one. A pane counts as busy only when "esc to interrupt" or "Waiting for" shows in the spinner line right 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. If the permission system denies your own `restart` (the command never runs), send one mailbox line to the grill/docs session, for example `send <you> --to <grill> 'restart denied, please /clear my pane and type: <prompt>'`. That session drives your pane: it types into it only when the pane is idle by the rule above.
52
+ `restart <name> <prompt...>` types the clear command (`/clear`, or `/new` for a `codex` name) and then the prompt into the session `<name>@<repo>`. An agent uses it to clear itself and resume from its saved work state. The command returns at once, so end your turn after it.
53
53
 
54
- `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. A `/clear` keeps the old process, so it never picks up a change to an installed plugin, a settings file, an MCP server or `PATH`; after such a change use `--process`. The agent command is the one `run` started, without its prompt, and the pane's start command for an older session. 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, the restart selects "exit and stop tasks" and writes the stopped jobs to `restart.log` and to a mailbox notice. The new process keeps the role: the session's own role, else `builder` from a prompt that resumes a `builder-*` handoff, else the one `--role` names. 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).
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.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 keeps the role: the session's own role, else `builder` from a prompt that resumes a `builder-*` handoff, else the one `--role` names. 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).
55
64
 
56
65
  `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.
57
66
 
@@ -1,5 +1,5 @@
1
1
  import { execFileSync, spawn, spawnSync } from 'node:child_process';
2
- import { appendFileSync, existsSync, mkdirSync, readFileSync, watchFile, writeFileSync } from 'node:fs';
2
+ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, watchFile, writeFileSync } from 'node:fs';
3
3
  import { basename, dirname, join, relative, resolve } from 'node:path';
4
4
  import { homedir } from 'node:os';
5
5
  import { fileURLToPath } from 'node:url';
@@ -90,7 +90,9 @@ Restart: node ${script} restart <name> [--after <seconds>] [--notify <agent,...>
90
90
  a long wait on a draft and a give-up go to <name> and each --notify agent;
91
91
  --process ends the agent and starts it again in the same pane with the prompt;
92
92
  it keeps the role, else takes it from a builder-* handoff name, and refuses
93
- a session with no role while another agent session runs in the repo)
93
+ a session with no role while another agent session runs in the repo;
94
+ refuses while a ❓ question of a claude session has no later human message
95
+ and the resumed handoff does not name it under "Open for the human")
94
96
  Down: node ${script} down [<name>...] (stop dispatch; stop the named sessions too)
95
97
  Dispatch: node ${script} dispatch (wake the tmux session named <agent> for each message sent --to <agent>)
96
98
 
@@ -107,6 +109,13 @@ const tmux = (...tmuxArgs) => spawnSync('tmux', tmuxArgs, { encoding: 'utf8' });
107
109
  const quote = (text) => `'${text.replaceAll("'", "'\\''")}'`;
108
110
  const BUILDER_PROMPT =
109
111
  'The user does not read this chat. Write no text between tool calls; end each turn with at most one line. Reports go to the grill session via SendMessage.';
112
+ const claudeTmpDir = join(homedir(), '.cache', 'claude-tmp');
113
+ const ensuredClaudeTmpDir = () => {
114
+ mkdirSync(claudeTmpDir, { recursive: true });
115
+ return claudeTmpDir;
116
+ };
117
+ const tempDirEnv = () => `CLAUDE_CODE_TMPDIR=${quote(ensuredClaudeTmpDir())} `;
118
+ const withTempDir = (command) => (/(^|\s)CLAUDE_CODE_TMPDIR=/.test(command) ? command : `${tempDirEnv()}${command}`);
110
119
  const withRole = (words) =>
111
120
  role === 'builder' && basename(words[0]) === 'claude' ? [...words, '--append-system-prompt', BUILDER_PROMPT] : words;
112
121
  const sessionExists = (name) => tmux('has-session', '-t', `=${name}`).status === 0;
@@ -151,6 +160,94 @@ const restartRoleOf = (session, prompt) => {
151
160
  const found = role ?? roleOf(session) ?? handoffRoleOf(prompt);
152
161
  return found === 'doc-agent' ? null : found;
153
162
  };
163
+ const claudeDir = process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude');
164
+ const isAlive = (pid) => {
165
+ try {
166
+ process.kill(pid, 0);
167
+ return true;
168
+ } catch (error) {
169
+ return error.code === 'EPERM';
170
+ }
171
+ };
172
+ const readJson = (path) => {
173
+ try {
174
+ return JSON.parse(readFileSync(path, 'utf8'));
175
+ } catch {
176
+ return null;
177
+ }
178
+ };
179
+ const claudeSessionIdOf = (session, own) => {
180
+ const sessionsDir = join(claudeDir, 'sessions');
181
+ const live = existsSync(sessionsDir)
182
+ ? readdirSync(sessionsDir)
183
+ .filter((name) => name.endsWith('.json'))
184
+ .map((name) => readJson(join(sessionsDir, name)))
185
+ .filter((entry) => entry?.sessionId && entry.tmux?.startsWith(`${session}:`) && isAlive(entry.pid))
186
+ .sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0))
187
+ : [];
188
+ if (live.length) return live[0].sessionId;
189
+ return own === session ? process.env.CLAUDE_CODE_SESSION_ID || null : null;
190
+ };
191
+ const transcriptOf = (sessionId) => {
192
+ const projects = join(claudeDir, 'projects');
193
+ if (!existsSync(projects)) return null;
194
+ return (
195
+ readdirSync(projects)
196
+ .map((project) => join(projects, project, `${sessionId}.jsonl`))
197
+ .find((path) => existsSync(path)) ?? null
198
+ );
199
+ };
200
+ const textOf = (content) =>
201
+ typeof content === 'string'
202
+ ? content
203
+ : (content ?? [])
204
+ .filter((block) => block?.type === 'text')
205
+ .map((block) => block.text)
206
+ .join('\n');
207
+ const isHumanTurn = (entry) =>
208
+ entry.type === 'user' &&
209
+ entry.origin?.kind === 'human' &&
210
+ !/^\s*<command-(name|message)>/.test(textOf(entry.message?.content));
211
+ const QUESTION_LINE = /^\s*(?:[-*]\s+)?❓\s*(.+)$/;
212
+ const normalize = (text) => text.replace(/\s+/g, ' ').trim();
213
+ const unansweredQuestions = (transcript) => {
214
+ let questions = [];
215
+ for (const line of readFileSync(transcript, 'utf8').split('\n')) {
216
+ let entry;
217
+ try {
218
+ entry = JSON.parse(line);
219
+ } catch {
220
+ continue;
221
+ }
222
+ if (isHumanTurn(entry)) questions = [];
223
+ else if (entry.type === 'assistant')
224
+ textOf(entry.message?.content)
225
+ .split('\n')
226
+ .map((text) => text.match(QUESTION_LINE)?.[1])
227
+ .filter(Boolean)
228
+ .forEach((question) => questions.push(normalize(question)));
229
+ }
230
+ return [...new Set(questions)];
231
+ };
232
+ const HANDOFF_NAME = /^\/handoff\s+resume\s+(\S+)/;
233
+ const openForHumanOf = (prompt) => {
234
+ const name = prompt.match(HANDOFF_NAME)?.[1];
235
+ const path = name && join(root, '.claude/handoffs', name.endsWith('.md') ? name : `${name}.md`);
236
+ if (!path || !existsSync(path)) return null;
237
+ const lines = readFileSync(path, 'utf8').split('\n');
238
+ const start = lines.findIndex((line) => /open for the human/i.test(line));
239
+ if (start < 0) return '';
240
+ const end = lines.findIndex((line, index) => index > start && /^#/.test(line));
241
+ return normalize(lines.slice(start, end < 0 ? undefined : end).join('\n'));
242
+ };
243
+ const droppedQuestions = (session, own, prompt) => {
244
+ if (session.startsWith('codex')) return [];
245
+ const sessionId = claudeSessionIdOf(session, own);
246
+ const transcript = sessionId && transcriptOf(sessionId);
247
+ if (!transcript) return [];
248
+ const open = openForHumanOf(prompt) ?? '';
249
+ return unansweredQuestions(transcript).filter((question) => !open.includes(question));
250
+ };
154
251
  const hasUnknownRole = (session, prompt) => {
155
252
  if (role !== undefined || roleOf(session) || handoffRoleOf(prompt)) return false;
156
253
  const peers = tmux('list-sessions', '-F', '#{session_name}')
@@ -246,8 +343,8 @@ const IDE_CHIP = /\[⧉ [^\]]*\]/g;
246
343
  const plain = (line) => line.replace(new RegExp(SGR, 'g'), '');
247
344
  const isRule = (line) => /^─{10,}$/.test(plain(line).trim());
248
345
  const isPromptMark = (line) => /^\s*[❯›]/.test(plain(line));
249
- /** A row of the background-agent panel below the footer (`❯ ⏺ main`, ` ◯ general-purpose …`). */
250
- const isPanelRow = (line) => /^\s*❯?\s*[⏺◯]/.test(plain(line));
346
+ /** A row of the background-agent panel below the footer (`❯ ⏺ main`, ` ● main`, ` ◯ general-purpose …`). */
347
+ const isPanelRow = (line) => /^\s*❯?\s*[⏺●◯]/.test(plain(line));
251
348
  const paneLines = (session) => (tmux('capture-pane', '-p', '-e', '-t', `=${session}:`).stdout ?? '').split('\n');
252
349
  const lastRuleIndex = (lines) => lines.findLastIndex(isRule);
253
350
  /**
@@ -287,7 +384,22 @@ const draftLine = (session) => {
287
384
  .trim();
288
385
  return text.length > 0 ? text : null;
289
386
  };
290
- const panelFocused = (lines) => lines.slice(lastRuleIndex(lines) + 1).some((line) => /^\s*❯\s*[⏺◯]/.test(plain(line)));
387
+ const isInverse = (codes) => {
388
+ for (let index = 0; index < codes.length; index++) {
389
+ if (codes[index] === '38' || codes[index] === '48') index += codes[index + 1] === '2' ? 4 : 2;
390
+ else if (codes[index] === '7') return true;
391
+ }
392
+ return false;
393
+ };
394
+ /** A focused footer pill or panel row is drawn inverse (`ESC[7m`); older builds mark a focused row with `❯`. */
395
+ const panelFocused = (lines) =>
396
+ lines
397
+ .slice(lastRuleIndex(lines) + 1)
398
+ .some(
399
+ (line) =>
400
+ [...line.matchAll(new RegExp(SGR, 'g'))].some((match) => isInverse(match[1].split(';'))) ||
401
+ /^\s*❯\s*[⏺●◯]/.test(plain(line)),
402
+ );
291
403
  const PANEL_UP_LIMIT = 10;
292
404
  /**
293
405
  * Keys typed while the focus sits in the background-agent panel go into the panel. Up moves the focus back to the
@@ -417,13 +529,19 @@ if (command === 'send' && sender) {
417
529
  process.stderr.write(`Unknown role ${role}. Only builder exists.\n`);
418
530
  process.exitCode = 1;
419
531
  } else if (command === 'run' && sender && words.length && dryRun) {
420
- process.stdout.write(`${role ? `ETHLETE_AGENT_ROLE=${role} ` : ''}${withRole(words).map(quote).join(' ')}\n`);
532
+ process.stdout.write(
533
+ `${withTempDir(`${role ? `ETHLETE_AGENT_ROLE=${role} ` : ''}${withRole(words).map(quote).join(' ')}`)}\n`,
534
+ );
421
535
  } else if (command === 'run' && sender && words.length && !runsInSession(words.slice(1))) {
422
536
  const [program, ...programArgs] = withRole(words);
423
537
  process.exitCode =
424
538
  spawnSync(program, programArgs, {
425
539
  stdio: 'inherit',
426
- env: role ? { ...process.env, ETHLETE_AGENT_ROLE: role } : process.env,
540
+ env: {
541
+ ...process.env,
542
+ CLAUDE_CODE_TMPDIR: ensuredClaudeTmpDir(),
543
+ ...(role ? { ETHLETE_AGENT_ROLE: role } : {}),
544
+ },
427
545
  }).status ?? 1;
428
546
  } else if (command === 'run' && sender && words.length) {
429
547
  const withEnv = process.env.AGENT_MAILBOX ? `AGENT_MAILBOX=${quote(process.env.AGENT_MAILBOX)} ` : '';
@@ -431,8 +549,8 @@ if (command === 'send' && sender) {
431
549
  startSession(DISPATCH_SESSION, `${withEnv}node ${quote(script)} dispatch`, true);
432
550
  const session = freeSessionFor(sender);
433
551
  const roleEnv = role ? `ETHLETE_AGENT_ROLE=${role} ` : '';
434
- const shellCommand = `${roleEnv}${withRole(words).map(quote).join(' ')}`;
435
- const baseCommand = `${roleEnv}${withRole(withoutPrompt(words)).map(quote).join(' ')}`;
552
+ const shellCommand = withTempDir(`${roleEnv}${withRole(words).map(quote).join(' ')}`);
553
+ const baseCommand = withTempDir(`${roleEnv}${withRole(withoutPrompt(words)).map(quote).join(' ')}`);
436
554
  if (process.env.TMUX) {
437
555
  if (!sessionExists(session)) {
438
556
  tmux('new-session', '-d', '-s', session, '-c', process.cwd(), shellCommand);
@@ -516,6 +634,7 @@ if (command === 'send' && sender) {
516
634
  const own = process.env.TMUX_PANE
517
635
  ? tmux('display-message', '-p', '-t', process.env.TMUX_PANE, '#{session_name}').stdout.trim()
518
636
  : null;
637
+ const dropped = session && !now ? droppedQuestions(session, own, words.join(' ')) : [];
519
638
  if (!session) {
520
639
  process.stderr.write(`No tmux session for ${sender}.\n`);
521
640
  process.exitCode = 1;
@@ -532,6 +651,11 @@ if (command === 'send' && sender) {
532
651
  `Refused: ${session} has no role and another agent session runs in this repo, so the new process could lose the builder rule. Resume a builder-* or doc-agent-* handoff, or pass --role builder or --role none.\n`,
533
652
  );
534
653
  process.exitCode = 1;
654
+ } else if (dropped.length) {
655
+ process.stderr.write(
656
+ `Refused: ${session} asked the human a ❓ question that no later human message answers, and the handoff does not name it. Put each question verbatim under "Open for the human" in the handoff the prompt resumes (/handoff resume <name>), then restart again:\n${dropped.map((question) => `❓ ${question}`).join('\n')}\n`,
657
+ );
658
+ process.exitCode = 1;
535
659
  } else if (now) {
536
660
  const type = (...keys) => tmux('send-keys', '-t', `=${session}:`, ...keys);
537
661
  sleep(Number(afterSeconds ?? RESTART_AFTER_SECONDS) * 1000);
@@ -547,7 +671,7 @@ if (command === 'send' && sender) {
547
671
  const pane = `=${session}:`;
548
672
  const restartRole = restartRoleOf(session, words.join(' '));
549
673
  const stored = commandWithoutPrompt(agentCommandOf(session));
550
- const base = restartRole ? commandWithRole(stored, restartRole) : stored;
674
+ const base = withTempDir(restartRole ? commandWithRole(stored, restartRole) : stored);
551
675
  if (restartRole) tmux('set-option', '-t', pane, ROLE_OPTION, restartRole);
552
676
  tmux('set-option', '-p', '-t', pane, 'remain-on-exit', 'on');
553
677
  type('-l', sender.startsWith('codex') ? '/quit' : '/exit');
@@ -74,8 +74,9 @@ rows = computed(() => this.items().map((item) => ({ ...item, createdAtLabel: for
74
74
 
75
75
  - Inline template/styles for small components; external `.html` / `.css` files
76
76
  for complex ones.
77
- - Component CSS is plain CSS wrapped in `@layer components`, with every primary colour
78
- value coming from the repository's theme tokens.
77
+ - Component CSS is plain CSS wrapped in `@layer components` (`@layer components.sdk` in
78
+ the Ethlete SDK itself), with every primary colour value coming from the repository's
79
+ theme tokens.
79
80
 
80
81
  ## Reactive state
81
82
 
@@ -108,6 +108,11 @@ full-strength neutral tint, so in dark mode it gives a light row with near-white
108
108
 
109
109
  ## Pitfalls
110
110
 
111
+ - A surface theme may have `elevation: -1` (a literal unary minus); the generator fails on a theme it cannot
112
+ parse. Filled form fields, table card rows and grid items resolve `parent.elevation + 1`; toasts and
113
+ `@ethlete/cdk` overlays with a backdrop always resolve elevation 1 (without a backdrop, `parent + 1`), and the
114
+ overlay scope class goes from `et-surface--inherited` to `et-surface--<theme>`. `@ethlete/cdk` CSS reads no
115
+ `--et-surface-*` token, so `etProvideSurface` on a cdk host does nothing.
111
116
  - `@property` `initial-value` cannot contain `var()`, so a public `--et-*` token
112
117
  declared via `@property` can never default to a theme token. If the default should
113
118
  come from the theme, don't declare an `@property` - consume the theme token directly
@@ -125,8 +130,9 @@ full-strength neutral tint, so in dark mode it gives a light row with near-white
125
130
  permitted for theme-less setups, but themes make it unnecessary. `injectSemanticColorTheme()`
126
131
  is a hard requirement wherever it is read.
127
132
  - **Cascade layers, not `:where()`, decide who wins against SDK component CSS.** SDK
128
- styles live in `@layer components`, so a utility or unlayered app CSS overrides them.
129
- An app rule inside `@layer components` loses. See the `app-styling` rule.
133
+ styles live in `@layer components.sdk`, nested in `components`, so an app rule in
134
+ `@layer components`, a utility, or unlayered app CSS overrides them. See the
135
+ `app-styling` rule.
130
136
 
131
137
  Styling a **story** file rather than a component? The colour rule is the same. Check the
132
138
  repository's Storybook guidance before assuming a Tailwind utility exists.
@@ -49,9 +49,8 @@ answer proposes waits for the user's approval as auto mode's own does.
49
49
  A subject the app does not offer the press on is refused: an unknown or resolved stand-in, one
50
50
  the day holds no time of, a context a rule names or the user named by hand.
51
51
 
52
- Tell the user a request waits in Timetrack, then read `approval` once they say they decided -
53
- do not poll in a loop. A request that is still waiting at the end of the day it was asked on
54
- expires; ask again rather than assuming it landed. Set `TIMETRACK_CLIENT` to name yourself in the
52
+ Tell the user a request waits, then read `approval` once they say they decided - do not poll.
53
+ A request still waiting at the end of its day expires; ask again. Set `TIMETRACK_CLIENT` to name yourself in the
55
54
  queue (Claude Code is named without it).
56
55
 
57
56
  **Never ask the user for a Jira token, and never write one into a file.** If a command reports
@@ -61,33 +60,44 @@ nobody can rotate.
61
60
 
62
61
  ## What each command is for
63
62
 
64
- | Command | Use it when |
65
- | ------------------------------------------ | --------------------------------------------------------------------------- |
66
- | `status` | Before anything else, when a Jira command failed and you need the cause |
67
- | `instance` | A setup step needs the instance's levels or its branch-subject field |
68
- | `issue <KEY>` | The user names a key and you need its summary, type or parent |
69
- | `search [text]` | The user describes work but names no key |
70
- | `project [path]` | You need the project a repository files into |
71
- | `create --summary "…"` | The work has no ticket and the user asked for one |
72
- | `log --issue <KEY> --minutes <n>` | The user asks to record time that nothing observed |
73
- | `day [YYYY-MM-DD]` | You need the evidence a day holds, not a screenshot of it |
74
- | `rows [YYYY-MM-DD]` | You need the rows the day drew, and the ids an edit names them by |
75
- | `edit <row-id> …` | The user asks you to correct one row of a day |
76
- | `rules` | You need to know why a band was named, or why it was not |
77
- | `standins` | You need to know which work still waits for a ticket, and for how long |
78
- | `standins --remove <id>` | A placeholder is wrong or too wide, and the user asked you to delete it |
79
- | `standins --rename <id> --name <text>` | The name a placeholder carries is wrong, and the user asked you to fix it |
80
- | `standins --merge <id> --into <id>` | Two placeholders are one piece of work, and the user asked you to join them |
81
- | `standins --resolve <id> --issue <KEY>` | The user named the issue a placeholder is, or the one a resolved one is now |
82
- | `naming [YYYY-MM-DD]` | A checkout was never offered a name and you need the step that stopped |
83
- | `worklogs [from] [to]` | You need what the user already booked in Tempo over a span of days |
84
- | `calendar [from] [to]` | You need the user's meetings and calendar entries over a span of days |
85
- | `sync <YYYY-MM-DD>` | The user asks what a Tempo sync of a day would write, or asks to sync it |
86
- | `worklog --delete <id> --day <YYYY-MM-DD>` | The user asked you to delete one of their own Tempo worklogs |
87
- | `approval <id>` | A write you queued: whether the user approved it, and what it answered |
88
- | `approvals` | You need what waits in the queue, from every caller |
89
- | `approval <id> --reject` | The user asked you to drop a waiting write, or you queued one by mistake |
90
- | `ask --stand-in <id>` / `--context <id>` | The user asks auto mode to look at a stand-in or an unnamed band again |
63
+ | Command | Use it when |
64
+ | ------------------------------------------ | ---------------------------------------------------------------------------- |
65
+ | `status` | Before anything else, when a Jira command failed and you need the cause |
66
+ | `instance` | A setup step needs the instance's levels or its branch-subject field |
67
+ | `issue <KEY>` | The user names a key and you need its summary, type or parent |
68
+ | `search [text]` | The user describes work but names no key |
69
+ | `project [path]` | You need the project a repository files into |
70
+ | `create --summary "…"` | The work has no ticket and the user asked for one |
71
+ | `log --issue <KEY> --minutes <n>` | The user asks to record time that nothing observed |
72
+ | `day [YYYY-MM-DD]` | You need the evidence a day holds, not a screenshot of it |
73
+ | `rows [YYYY-MM-DD]` | You need the rows the day drew, and the ids an edit names them by |
74
+ | `edit <row-id> …` | The user asks you to correct one row of a day |
75
+ | `rules` | You need to know why a band was named, or why it was not |
76
+ | `standins` | You need to know which work still waits for a ticket, and for how long |
77
+ | `standins --remove <id>` | A placeholder is wrong or too wide, and the user asked you to delete it |
78
+ | `standins --rename <id> --name <text>` | The name a placeholder carries is wrong, and the user asked you to fix it |
79
+ | `standins --merge <id> --into <id>` | Two placeholders are one piece of work, and the user asked you to join them |
80
+ | `standins --resolve <id> --issue <KEY>` | The user named the issue a placeholder is, or the one a resolved one is now |
81
+ | `naming [YYYY-MM-DD]` | A checkout was never offered a name and you need the step that stopped |
82
+ | `transcript [YYYY-MM-DD]` | You need what the user said in the day's calls (their microphone) |
83
+ | `resync [path…] [--replace]` | Checkouts got a project link and their agent session logs must be read again |
84
+ | `worklogs [from] [to]` | You need what the user already booked in Tempo over a span of days |
85
+ | `calendar [from] [to]` | You need the user's meetings and calendar entries over a span of days |
86
+ | `sync <YYYY-MM-DD>` | The user asks what a Tempo sync of a day would write, or asks to sync it |
87
+ | `worklog --delete <id> --day <YYYY-MM-DD>` | The user asked you to delete one of their own Tempo worklogs |
88
+ | `approval <id>` | A write you queued: whether the user approved it, and what it answered |
89
+ | `approvals` | You need what waits in the queue, from every caller |
90
+ | `approval <id> --reject` | The user asked you to drop a waiting write, or you queued one by mistake |
91
+ | `ask --stand-in <id>` / `--context <id>` | The user asks auto mode to look at a stand-in or an unnamed band again |
92
+
93
+ `naming` reports whether a Tempo token is stored, how far the worklog history got, and per checkout the
94
+ offer or the reason there is none (`already-named`, `no-project-link`, `no-history`,
95
+ `project-too-small`, `too-few-days`, `share-too-low`); read a `history` of `failed` or `no-token` first.
96
+ `rules` reads the settings that name a day's work - attribution rules, project links, background
97
+ projects, ruled applications - and holds no host, account or token, so it is safe to quote. A
98
+ rule that donates its time carries no issue key, and a `backgroundProjects` project keeps only the
99
+ minutes no other band claims. `resync` queues a re-read, `--replace` overwrites what the store holds
100
+ (after a parser fix).
91
101
 
92
102
  `git-flow start` uses the same channel, so a branch is named from the real issue rather than
93
103
  from a key you typed. Follow the repository's branch workflow when creating a branch.
@@ -144,148 +154,33 @@ minutes ago.
144
154
  An edit may correct a row's times, its name, its note and whether it syncs. It may not split, merge
145
155
  or delete one - restructuring a day is the user's own decision, made on the screen.
146
156
 
147
- ## Why a band carries the name it does
148
-
149
- `rules` reads the settings that name a day's work - the attribution rules, the project links,
150
- the background projects and the applications the user has ruled in or out. It holds no host, no
151
- account and no token, so it is safe to quote back to the user.
152
-
153
- ```bash
154
- {%packageRunner%} ethlete-agents timetrack rules # a summary of the rules
155
- {%packageRunner%} ethlete-agents timetrack rules --json # the whole answer
156
- ```
157
-
158
- Read it before claiming a band should have been named something: a rule that donates its time
159
- carries no issue key, and a project in `backgroundProjects` keeps only the minutes no other
160
- band claims.
161
-
162
157
  ## Work with no ticket yet
163
158
 
164
159
  A **stand-in** is a name the user gave work that Jira does not hold yet. It takes bands across
165
- days and across checkouts, and it books nothing. `standins` lists them:
166
-
167
- ```bash
168
- {%packageRunner%} ethlete-agents timetrack standins # the open ones, oldest first
169
- {%packageRunner%} ethlete-agents timetrack standins --json # the whole answer, resolved ones included
170
- ```
171
-
172
- **Never open or resolve a stand-in.** The name is the user's own word for their work, and the
173
- app is the only place they give it. If the user asks for a ticket, use `create` and tell them
174
- to resolve the stand-in in Timetrack.
175
-
176
- A placeholder is drawn per branch, and per directory where the branch names no piece of work.
177
- A base branch, or no branch at all, says nothing about what was worked on, so the directory the
178
- commits touched answers instead. That directory is the project the repository declares - the one
179
- carrying the `project.json` or `package.json` above the changed files. A repository that declares
180
- none lets its own commits pick the grain between them. A directory named with a leading dot is
181
- the checkout's own tooling, so it never answers: a commit in `.changeset` or `.github` is
182
- bookkeeping for another piece of work.
183
-
184
- Where the directories cannot answer either, the branch the checkout was next cut onto does. A
185
- branch is very often cut once the work on it has started, so the minutes before the cut sit on
186
- the base branch although they are that branch's work.
187
-
188
- One placeholder written before any of that was true covers a whole checkout, and it blocks a
189
- per-branch placeholder for every branch of it. The list says so:
190
-
191
- ```
192
- Competition journey spec frontend in FIFAGG 3d old, 3 day(s) of work
193
- covers all of /home/tom/dev/fifagg/specs, so no branch of it gets one of its own
194
- ```
195
-
196
- Two separate things cause that, and either alone is enough: the record names no branch, or the
197
- rule naming it names no branch. The line above reports both, so take it at its word rather than
198
- reading `--json` yourself.
199
-
200
- ### Give one another name
201
-
202
- The name is only wrong, and the work behind it is right:
203
-
204
- ```bash
205
- {%packageRunner%} ethlete-agents timetrack standins --rename <id> --name '20260921 competition navigation rework'
206
- ```
207
-
208
- The days it holds and the rules that name it stay, which is what a delete and a fresh record would
209
- lose. Rename one only when the user asks. The name is their own word for their work, so a name you
210
- find unclear is not a fault to correct.
211
-
212
- ### Resolve one to its issue
160
+ days and checkouts and books nothing. `standins` lists the open ones, oldest first (`--json`
161
+ adds the resolved ones).
213
162
 
214
- The user told you which Jira issue a placeholder is:
215
-
216
- ```bash
217
- {%packageRunner%} ethlete-agents timetrack standins --resolve <id> --issue <KEY>
218
- ```
219
-
220
- It resolves the placeholder as the user's own pick in the app does, so every band on every day it
221
- held takes the key. One that is resolved already moves to the new key, as the app's Undo and a new
222
- pick would. It writes nothing to Tempo, so a day of it already booked keeps the old key there. The
223
- app reads the issue from Jira before it queues anything, so an unknown key or placeholder answers an
224
- error and nothing waits. A done issue is fine. The approval card shows the name, the old key and the
225
- new one with its summary.
226
-
227
- ### Re-cut one that named two pieces of work
228
-
229
- A record covering a whole checkout is repaired rather than deleted, because a delete strands its
230
- days. `--split` re-cuts it into one record per directory, and moves each day onto the right one:
231
-
232
- ```bash
233
- {%packageRunner%} ethlete-agents timetrack standins --split <id> # the plan, writes nothing
234
- {%packageRunner%} ethlete-agents timetrack standins --split <id> --force # queue it for approval
235
- ```
236
-
237
- Without `--force` it prints every directory the commits name, with its commit count and its days,
238
- then says which of them it would write. A directory under three commits is an edit made in
239
- passing rather than a piece of work, so it is listed but not written. Pass
240
- `--paths <dir>,<dir>` to pick the pieces yourself.
241
-
242
- The commits are read across every branch, and only the ones the checkout's own `user.email`
243
- authored. That is the history the collector that opened the record read, so work left on an
244
- unmerged branch still counts and a colleague's commits never shape a piece. `--author <email>`
245
- overrides the address.
246
-
247
- A day the record covers that holds no commit of yours goes back to unnamed, and the split names
248
- it. That is the honest answer: nothing says which directory it was. The day review is where it
249
- gets named, and `--claim <dir>` gives every such day to one directory instead.
250
-
251
- The record and its checkout-wide rule always go, even when a day is left unnamed. Both are read
252
- as covering every branch of the checkout, so keeping either would block any later branch from
253
- getting a record of its own — which is the fault the repair exists to cure.
254
-
255
- The record must name the checkout it was opened for. One the user opened by hand names none, and
256
- the split refuses it.
257
-
258
- You may delete one, because that takes a name away rather than putting one on the day:
163
+ **Never open or resolve a stand-in without the user asking.** The name is the user's own word for
164
+ their work, and the app is the only place they give it. If the user asks for a ticket, use
165
+ `create` and tell them to resolve the stand-in in Timetrack.
259
166
 
260
167
  ```bash
168
+ {%packageRunner%} ethlete-agents timetrack standins --rename <id> --name '<text>' # only the name is wrong
169
+ {%packageRunner%} ethlete-agents timetrack standins --resolve <id> --issue <KEY> # the user named the issue
170
+ {%packageRunner%} ethlete-agents timetrack standins --merge <id> --into <id> # two are one piece of work
171
+ {%packageRunner%} ethlete-agents timetrack standins --split <id> # plan only; add --force to queue
261
172
  {%packageRunner%} ethlete-agents timetrack standins --remove <id>
262
173
  ```
263
174
 
264
- The rule that named it goes with it, and what happens next is worth knowing before you ask:
265
-
266
- - The record names a branch. The delete refuses that branch, and no second one opens for it.
267
- - It names none. The delete refuses nothing, so the next pass opens one per branch instead.
268
-
269
- **Deleting one strands every day but today.** Only the day the app next reviews gets a new
270
- placeholder; every earlier day the record covered then reads as unnamed, with nothing left to
271
- say what it was. The command refuses such a delete and lists the days, and `--force` makes it
272
- anyway. Ask the user before you use `--force`, and tell them which days they will lose.
273
-
274
- ## Why a checkout was never offered a name
275
-
276
- The day screen offers a whole checkout one issue when the user's own record already answers it. The
277
- card is either drawn or it is not, and every step that can stop it is invisible from the screen.
278
- `naming` names the step:
279
-
280
- ```bash
281
- {%packageRunner%} ethlete-agents timetrack naming # today
282
- {%packageRunner%} ethlete-agents timetrack naming 2026-09-14
283
- ```
284
-
285
- It reports whether a Tempo token is stored, how far the read of the worklog history got, and for each
286
- checkout the day saw either the offer or the reason there is none - `already-named`,
287
- `no-project-link`, `no-history`, `project-too-small`, `too-few-days` or `share-too-low`. A `history`
288
- of `failed` or `no-token` explains every checkout at once, so read that line first.
175
+ - `--resolve` moves every band on every day the placeholder held to the key, and writes nothing to
176
+ Tempo, so a day already booked keeps the old key there. An unknown key or placeholder errors
177
+ and nothing waits.
178
+ - `--split` re-cuts a record that covers a whole checkout into one record per directory, from the
179
+ commits the checkout's own `user.email` authored (`--author <email>` overrides). Without
180
+ `--force` it prints the plan; `--paths <dir>,<dir>` picks the pieces, `--claim <dir>` gives
181
+ the days without a commit to one directory. The record must name the checkout it was opened for.
182
+ - **`--remove` strands every day but today** as unnamed. It refuses such a delete and lists the
183
+ days; ask the user before you pass `--force`, and tell them which days they lose.
289
184
 
290
185
  ## What Tempo already holds
291
186
 
@@ -342,8 +237,7 @@ printed:
342
237
  {%packageRunner%} ethlete-agents timetrack sync 2026-09-07 --write --plan 1a2b3c4d
343
238
  ```
344
239
 
345
- The write is queued, and the user approves it in the app as well - "Approve all" never includes
346
- it. On approval the app plans the day again and refuses, writing nothing, when the hash differs -
240
+ "Approve all" never includes it. On approval the app plans the day again and refuses when the hash differs -
347
241
  the day changed since the user saw it, so read it again and ask again. `--write` without `--plan`
348
242
  is refused at once. Once approved, `approval <id>` prints each row as `written`, `blocked`,
349
243
  `skipped` or `failed`, with the worklog id or the error, and exits non-zero while a row did not
@@ -363,17 +257,14 @@ id and its day off `worklogs --json`:
363
257
  {%packageRunner%} ethlete-agents timetrack worklog --delete 98765 --day 2026-09-07
364
258
  ```
365
259
 
366
- It is a Tempo write, so the same rule holds: **name the worklog to the user, and delete only after
367
- they confirmed that one in this conversation.** The app refuses, deleting nothing, an id that is not
368
- among the account's own worklogs on that day. The delete is queued for the user's approval like
369
- `sync --write`; once approved, `approval <id>` answers what went, and the app drops its own record
370
- of the worklog, so the next `sync` of the day plans from what Tempo holds.
260
+ **Name the worklog to the user, and delete only after they confirmed that one in this conversation.**
261
+ The app refuses an id that is not among the account's own worklogs on that day. Once approved,
262
+ `approval <id>` answers what went, and the next `sync` of the day plans from what Tempo holds.
371
263
 
372
264
  ## Writes
373
265
 
374
- Four commands write to Jira or Tempo, so all need the user to have asked for them in this
375
- conversation - `sync --write` and `worklog --delete` are described above. Each is queued for the
376
- user's approval in the app:
266
+ Writes to Jira or Tempo need the user to have asked for them in this conversation (`sync --write` and
267
+ `worklog --delete` are above):
377
268
 
378
269
  ```bash
379
270
  {%packageRunner%} ethlete-agents timetrack create --summary "Reset password mail is not sent" --project FIP
package/migrations.json CHANGED
@@ -1,14 +1,5 @@
1
1
  {
2
2
  "migrations": [
3
- {
4
- "name": "app-styling-utilities",
5
- "version": "0.1.0-next.17",
6
- "kind": "assisted",
7
- "level": "required",
8
- "description": "App rules in @layer components move out of that layer, so SDK styles stop overriding them.",
9
- "instructions": "./migrations/app-styling-utilities.md",
10
- "docs": "/components/setup"
11
- },
12
3
  {
13
4
  "name": "list-state-query-form",
14
5
  "version": "0.1.0-next.17",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/agent-rules",
3
- "version": "0.1.0-next.33",
3
+ "version": "0.1.0-next.34",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/ethlete-io/ethdk",
@@ -0,0 +1,11 @@
1
+ import { ExecFileSyncOptions, SpawnSyncOptions, SpawnSyncReturns } from 'child_process';
2
+ /** `process.env` plus `extra` without the `GIT_*` variables inherited from a hook, so git in a temp repo never reaches the hook's repo. */
3
+ export declare const gitEnv: (extra?: Record<string, string | undefined>) => NodeJS.ProcessEnv;
4
+ /** `execFileSync('git', args, options)` with every inherited `GIT_*` variable stripped. */
5
+ export declare const gitExec: (args: string[], options?: ExecFileSyncOptions) => string & Buffer;
6
+ /** `spawnSync('git', args, options)` with every inherited `GIT_*` variable stripped. */
7
+ export declare const gitSpawn: (args: string[], options?: SpawnSyncOptions) => SpawnSyncReturns<string & Buffer>;
8
+ /** Runs git in `dir` with `GIT_*` stripped and returns trimmed stdout. */
9
+ export declare const git: (dir: string, ...args: string[]) => string;
10
+ /** Makes a temp directory, runs `git init` in it and returns its path. */
11
+ export declare const tempGitRepo: (prefix?: string) => string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tempGitRepo = exports.git = exports.gitSpawn = exports.gitExec = exports.gitEnv = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const fs_1 = require("fs");
6
+ const os_1 = require("os");
7
+ const path_1 = require("path");
8
+ /** `process.env` plus `extra` without the `GIT_*` variables inherited from a hook, so git in a temp repo never reaches the hook's repo. */
9
+ const gitEnv = (extra = {}) => {
10
+ const merged = Object.assign(Object.assign({}, process.env), extra);
11
+ return Object.fromEntries(Object.entries(merged).filter(([key, value]) => !(key.startsWith('GIT_') && process.env[key] === value)));
12
+ };
13
+ exports.gitEnv = gitEnv;
14
+ const withGitEnv = (options) => (Object.assign(Object.assign({}, options), { env: (0, exports.gitEnv)(options === null || options === void 0 ? void 0 : options.env) }));
15
+ /** `execFileSync('git', args, options)` with every inherited `GIT_*` variable stripped. */
16
+ const gitExec = (args, options) => (0, child_process_1.execFileSync)('git', args, withGitEnv(options));
17
+ exports.gitExec = gitExec;
18
+ /** `spawnSync('git', args, options)` with every inherited `GIT_*` variable stripped. */
19
+ const gitSpawn = (args, options) => (0, child_process_1.spawnSync)('git', args, withGitEnv(options));
20
+ exports.gitSpawn = gitSpawn;
21
+ /** Runs git in `dir` with `GIT_*` stripped and returns trimmed stdout. */
22
+ const git = (dir, ...args) => (0, exports.gitExec)(args, { cwd: dir, encoding: 'utf8', stdio: 'pipe' }).trim();
23
+ exports.git = git;
24
+ /** Makes a temp directory, runs `git init` in it and returns its path. */
25
+ const tempGitRepo = (prefix = 'git-spec-') => {
26
+ const dir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), prefix));
27
+ (0, exports.git)(dir, 'init', '-q');
28
+ return dir;
29
+ };
30
+ exports.tempGitRepo = tempGitRepo;
31
+ //# sourceMappingURL=git-test-env.fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-test-env.fixtures.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/git-test-env.fixtures.ts"],"names":[],"mappings":";;;AAAA,iDAAiH;AACjH,2BAAiC;AACjC,2BAA4B;AAC5B,+BAA4B;AAE5B,2IAA2I;AACpI,MAAM,MAAM,GAAG,CAAC,QAA4C,EAAE,EAAE,EAAE;IACvE,MAAM,MAAM,mCAAQ,OAAO,CAAC,GAAG,GAAK,KAAK,CAAE,CAAC;IAC5C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CACpF,CAAC;AACzB,CAAC,CAAC;AALW,QAAA,MAAM,UAKjB;AAEF,MAAM,UAAU,GAAG,CAAwC,OAAW,EAAE,EAAE,CAAC,iCACtE,OAAO,KACV,GAAG,EAAE,IAAA,cAAM,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,IACzB,CAAC;AAEH,2FAA2F;AACpF,MAAM,OAAO,GAAG,CAAC,IAAc,EAAE,OAA6B,EAAE,EAAE,CACvE,IAAA,4BAAY,EAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAoB,CAAC;AADvD,QAAA,OAAO,WACgD;AAEpE,wFAAwF;AACjF,MAAM,QAAQ,GAAG,CAAC,IAAc,EAAE,OAA0B,EAAE,EAAE,CACrE,IAAA,yBAAS,EAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAsC,CAAC;AADtE,QAAA,QAAQ,YAC8D;AAEnF,0EAA0E;AACnE,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,GAAG,IAAc,EAAE,EAAE,CACpD,IAAA,eAAO,EAAC,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AADzD,QAAA,GAAG,OACsD;AAEtE,0EAA0E;AACnE,MAAM,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,EAAE,EAAE;IAClD,MAAM,GAAG,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,IAAA,WAAM,GAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,IAAA,WAAG,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
@@ -1,63 +0,0 @@
1
- # Move app CSS out of `@layer components`
2
-
3
- The `app-styling` rule now says how app components are styled: Tailwind utilities in the
4
- template, CSS only for what a utility cannot express, and never an app rule in
5
- `@layer components`. SDK styles are injected into that layer at runtime, after the app's
6
- stylesheet, so an app rule there ties on layer and loses on source order. That is a bug today,
7
- and this task fixes it. The rest of the rule applies when a component is next edited.
8
-
9
- ## Before you start
10
-
11
- If this repo has no `app-styling` rule yet (in `AGENTS.md`, or under `.claude/rules/ethlete/`),
12
- run `ethlete-agents sync` with this repo's package manager (`yarn`, `pnpm exec` or `npx`), then
13
- read the rule. If the repo's own styling rules (a styleguide, `CONTRIBUTING.md`, the parts of
14
- `AGENTS.md` outside the generated block) forbid a change below, follow them and report the
15
- conflict.
16
-
17
- ## What to change
18
-
19
- 1. Find the app stylesheets with a `@layer components` block, global stylesheets included:
20
-
21
- ```bash
22
- grep -rlE '@layer components' apps libs --include='*.css' --include='*.scss' --include='*.sass' --include='*.less'
23
- ```
24
-
25
- 2. In each, move the rules out of the block into `@layer utilities`, and delete the empty
26
- block. In `@layer utilities` a rule still beats the SDK, and does not beat every utility the
27
- way unlayered CSS would.
28
- 3. The move lets these rules win over SDK styles they used to lose to. Check the views that use
29
- them. Where a view now looks wrong because the old rule was never meant to apply, delete the
30
- rule instead.
31
-
32
- ## Leave these alone
33
-
34
- - A library that ships its own CSS to other repos. The rule is about app components.
35
- - Generated theme files, such as the surface and colour themes `@ethlete/core` writes.
36
- - `--spacing` and the other rem scales in `@theme`. If the app has not set `--spacing: 0.4rem`,
37
- setting it now rescales every utility already in use: report it and leave it.
38
- - `html { font-size: 62.5%; }`: if it is missing, report it and leave it. Adding it rescales
39
- every `rem` the app uses.
40
-
41
- ## On touch, not in this task
42
-
43
- Rewriting BEM classes and component stylesheets to utilities, replacing hardcoded colours with
44
- theme tokens, and adding `ViewEncapsulation.None` to a component that relies on emulated CSS
45
- (its CSS would leak) happen when someone edits that component. Count what is left for the
46
- final message:
47
-
48
- ```bash
49
- grep -rlE 'styleUrls?:' apps libs --include='*.ts' | wc -l
50
- grep -rlE 'class="[^"]*\b[a-z0-9-]+__[a-z0-9-]+' apps libs --include='*.html' --include='*.ts' | wc -l
51
- grep -rlE '@Component\(' apps libs --include='*.ts' | xargs grep -LE 'ViewEncapsulation\.None' | wc -l
52
- ```
53
-
54
- ## Done when
55
-
56
- - The grep in step 1 finds no app stylesheet, apart from the ones under "Leave these alone".
57
- - The type check, lint and build pass for every project you changed.
58
- - Each view that uses a moved rule is checked in the browser. A view you cannot open (the login
59
- fails, no API) is listed as unchecked in your final message; that does not block the task.
60
- - Your final message gives the three counts above, and whether `--spacing` and the 62.5% root
61
- are set.
62
-
63
- Then delete this task file.