@event4u/agent-config 1.9.1 → 1.12.0

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.
Files changed (77) hide show
  1. package/.agent-src/commands/agent-handoff.md +15 -0
  2. package/.agent-src/commands/chat-history-clear.md +98 -0
  3. package/.agent-src/commands/chat-history-resume.md +178 -0
  4. package/.agent-src/commands/chat-history.md +102 -0
  5. package/.agent-src/commands/compress.md +9 -9
  6. package/.agent-src/commands/copilot-agents-init.md +1 -1
  7. package/.agent-src/commands/fix-portability.md +2 -2
  8. package/.agent-src/commands/fix-pr-bot-comments.md +1 -1
  9. package/.agent-src/commands/fix-pr-developer-comments.md +1 -1
  10. package/.agent-src/commands/fix-references.md +2 -2
  11. package/.agent-src/commands/mode.md +5 -5
  12. package/.agent-src/commands/onboard.md +171 -0
  13. package/.agent-src/commands/roadmap-create.md +7 -2
  14. package/.agent-src/commands/roadmap-execute.md +2 -2
  15. package/.agent-src/commands/set-cost-profile.md +101 -0
  16. package/.agent-src/commands/sync-agent-settings.md +122 -0
  17. package/.agent-src/commands/sync-gitignore.md +104 -0
  18. package/.agent-src/commands/tests-execute.md +6 -6
  19. package/.agent-src/commands/upstream-contribute.md +5 -4
  20. package/.agent-src/contexts/augment-infrastructure.md +2 -2
  21. package/.agent-src/contexts/override-system.md +1 -1
  22. package/.agent-src/contexts/subagent-configuration.md +3 -3
  23. package/.agent-src/guidelines/agent-infra/layered-settings.md +48 -5
  24. package/.agent-src/rules/ask-when-uncertain.md +56 -3
  25. package/.agent-src/rules/augment-portability.md +52 -1
  26. package/.agent-src/rules/augment-source-of-truth.md +10 -10
  27. package/.agent-src/rules/chat-history.md +171 -0
  28. package/.agent-src/rules/docker-commands.md +5 -7
  29. package/.agent-src/rules/docs-sync.md +13 -9
  30. package/.agent-src/rules/improve-before-implement.md +2 -0
  31. package/.agent-src/rules/onboarding-gate.md +94 -0
  32. package/.agent-src/rules/package-ci-checks.md +6 -5
  33. package/.agent-src/rules/roadmap-progress-sync.md +24 -13
  34. package/.agent-src/rules/size-enforcement.md +1 -1
  35. package/.agent-src/rules/skill-quality.md +1 -1
  36. package/.agent-src/rules/think-before-action.md +1 -0
  37. package/.agent-src/scripts/update_roadmap_progress.py +26 -9
  38. package/.agent-src/skills/check-refs/SKILL.md +1 -1
  39. package/.agent-src/skills/command-routing/SKILL.md +1 -1
  40. package/.agent-src/skills/command-writing/SKILL.md +4 -3
  41. package/.agent-src/skills/file-editor/SKILL.md +2 -2
  42. package/.agent-src/skills/guideline-writing/SKILL.md +4 -3
  43. package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +2 -2
  44. package/.agent-src/skills/lint-skills/SKILL.md +1 -1
  45. package/.agent-src/skills/roadmap-management/SKILL.md +13 -10
  46. package/.agent-src/skills/rtk-output-filtering/SKILL.md +20 -30
  47. package/.agent-src/skills/rule-writing/SKILL.md +5 -5
  48. package/.agent-src/skills/terragrunt/SKILL.md +0 -8
  49. package/.agent-src/skills/upstream-contribute/SKILL.md +5 -4
  50. package/.agent-src/templates/agent-settings.md +86 -34
  51. package/.claude-plugin/marketplace.json +1 -1
  52. package/AGENTS.md +2 -2
  53. package/CHANGELOG.md +296 -0
  54. package/CONTRIBUTING.md +89 -40
  55. package/README.md +3 -3
  56. package/composer.json +2 -1
  57. package/config/agent-settings.template.yml +45 -6
  58. package/config/gitignore-block.txt +24 -0
  59. package/config/profiles/balanced.ini +5 -0
  60. package/config/profiles/full.ini +5 -0
  61. package/config/profiles/minimal.ini +5 -0
  62. package/docs/customization.md +30 -4
  63. package/docs/getting-started.md +52 -3
  64. package/docs/mcp.md +15 -4
  65. package/package.json +13 -2
  66. package/scripts/agent-config +155 -0
  67. package/scripts/chat_history.py +519 -0
  68. package/scripts/check_portability.py +151 -1
  69. package/scripts/install.py +55 -3
  70. package/scripts/install.sh +50 -21
  71. package/scripts/mcp_render.py +30 -16
  72. package/scripts/release.py +588 -0
  73. package/scripts/sync_agent_settings.py +211 -0
  74. package/scripts/sync_gitignore.py +226 -0
  75. package/templates/agent-config-wrapper.sh +47 -0
  76. package/.agent-src/commands/config-agent-settings.md +0 -126
  77. package/.agent-src/skills/eloquent/evals/last-run.json +0 -99
@@ -5,7 +5,8 @@ Two-file settings model: **team defaults** (committed) and
5
5
  without forcing every developer to work the same way.
6
6
 
7
7
  Referenced by `road-to-project-memory.md` Phase 0. Consumed by the
8
- `config-agent-settings` command and the settings loader.
8
+ settings loader, the `/onboard` command, and any agent that edits
9
+ `.agent-settings.yml` on user request.
9
10
 
10
11
  ## The two files
11
12
 
@@ -84,8 +85,9 @@ mistakenly committed) migrate by:
84
85
  repo history only if it leaked personal tokens. Otherwise leave
85
86
  it — future commits supersede.
86
87
 
87
- The `config-agent-settings` command performs steps 1–3 and 5
88
- automatically when it detects a one-file setup.
88
+ The `/onboard` command and any agent that edits settings on user
89
+ request should walk steps 1–3 and 5 automatically when it detects
90
+ a one-file setup.
89
91
 
90
92
  ## .gitignore expectations
91
93
 
@@ -105,8 +107,9 @@ pattern (e.g. `*.yml` in a nested folder) would otherwise match.
105
107
  directly. The loader returns the merged view already.
106
108
  - **Commands** that mutate settings must state which layer they
107
109
  write to. Writing to the wrong layer is a spec bug.
108
- - **`config-agent-settings`** is the single writer for both files.
109
- Other commands MUST delegate no ad-hoc YAML edits.
110
+ - Writes to either file MUST follow the [section-aware merge
111
+ rules](#section-aware-merge-rules)preserve existing values,
112
+ template order, and comments. No ad-hoc YAML rewrites.
110
113
 
111
114
  ## Persona-list merge semantics
112
115
 
@@ -140,6 +143,46 @@ If the project locks `personas.default` via `locked_keys`, steps 2
140
143
  and 4 are ignored with a one-line warning — the developer cannot
141
144
  narrow a team-locked cast.
142
145
 
146
+ ## Section-aware merge rules
147
+
148
+ Any agent that writes `.agent-settings.yml` or
149
+ `.agent-project-settings.yml` on the user's behalf (including
150
+ `/onboard`, `/set-cost-profile`, and ad-hoc "change value X" requests)
151
+ MUST follow these rules. Initial file creation and legacy migration
152
+ are owned by `scripts/install.py`; these rules govern every edit
153
+ after that.
154
+
155
+ For each section in the template
156
+ ([`agent-settings.md`](../../templates/agent-settings.md)), walked in
157
+ template order:
158
+
159
+ - Keep the section header and its comments verbatim from the template.
160
+ - For each key under the section:
161
+ - **Key exists in user's file** → use the user's current value.
162
+ - **Key missing** → use the template default.
163
+ - **Unknown sections/keys** the user has added → preserve at the end
164
+ of the section (or in a trailing `_user:` block if no matching
165
+ section exists).
166
+
167
+ Invariants:
168
+
169
+ - Template section **order** always wins — reorder existing keys to
170
+ match.
171
+ - Existing scalar values are **never overwritten** unless the user
172
+ asked for that specific change.
173
+ - New keys added to the template land with their default value.
174
+ - Comments from the template replace user comments in the same
175
+ position — comments are documentation, not user data.
176
+ - Write with 2-space indent, no tabs, no trailing whitespace.
177
+ - Never commit — `.agent-settings.yml` is git-ignored.
178
+ - If a legacy flat `.agent-settings` (key=value) is still present,
179
+ stop and tell the user to run `scripts/install` — migration is the
180
+ installer's job, never the agent's.
181
+
182
+ Template drift (new keys shipped by a package update) is resolved by
183
+ re-running `scripts/install` or by the agent walking these rules on
184
+ the next explicit settings edit.
185
+
143
186
  ## Anti-patterns
144
187
 
145
188
  - **Do NOT** commit `.agent-settings.yml`. It contains developer
@@ -33,6 +33,7 @@ request matches one of these without further context, ask **before** touching co
33
33
  | "refactor X" | Target pattern? Boundaries? | "Refactor toward what — smaller methods, extract class, or something else?" |
34
34
  | "use best practices" | Whose? For what? | "Best practices for what specifically — testing, naming, structure?" |
35
35
  | "handle errors properly" | Which errors? How? Log, retry, propagate? | "For which failure modes, and what should happen on error?" |
36
+ | "add a UI / component / tile / page" when the repo mixes frameworks | Which stack? Tailwind? Flux? Livewire? Custom? | "This repo uses {A} and {B} for UI — which one for this?" |
36
37
 
37
38
  **Escape hatch:** If surrounding context (ticket, open file, prior conversation)
38
39
  makes the answer unambiguous, proceed — but state the assumption explicitly.
@@ -41,9 +42,61 @@ makes the answer unambiguous, proceed — but state the assumption explicitly.
41
42
 
42
43
  Be specific. Present numbered options (per `user-interaction`). Keep it short.
43
44
 
44
- - Simple (binary, small): multiple at once, numbered
45
- - Complex (needs thinking): one at a time, wait for answer
46
- - Handoff (model switch): ask LAST
45
+ ### The Iron Law one question per turn, ALWAYS
46
+
47
+ ```
48
+ ONE QUESTION PER TURN. NO EXCEPTIONS.
49
+ ASK. WAIT FOR THE ANSWER. THEN ASK THE NEXT.
50
+ ```
51
+
52
+ This is absolute. Not a default, not a guideline, not "usually". Every
53
+ turn that contains a question contains **exactly one** question. Even
54
+ if the questions look trivial. Even if they look independent. Even if
55
+ they would fit on one screen. Even if batching "feels more efficient".
56
+
57
+ The user must never have to track sub-numbers, scroll through stacked
58
+ option blocks, or split their reply across multiple questions. One
59
+ question, numbered options (per `user-interaction`), one short answer,
60
+ next turn.
61
+
62
+ Rationale — why even "trivial" batches fail:
63
+
64
+ | Situation | Why serial always wins |
65
+ |---|---|
66
+ | Design / architecture decisions | Answer to Q1 reframes Q2 |
67
+ | Naming / command-syntax / API shape | Later choices depend on it |
68
+ | Scope / PR boundaries | Changes what the other questions even mean |
69
+ | Tool / library selection | Downstream choices branch from it |
70
+ | "Which approach: A vs B vs C" | Each answer opens a different follow-up |
71
+ | Even "independent" yes/no pairs | User still has to parse two contexts |
72
+ | Any question the user has to **think** about, not just pick | Thinking load compounds when stacked |
73
+
74
+ ### Self-check before asking
75
+
76
+ Before sending a turn with a question, ask yourself:
77
+
78
+ 1. Does this turn contain more than one `?` directed at the user?
79
+ 2. Does this turn present two or more separate numbered-option blocks?
80
+ 3. Would the user need to reply with a structured answer (`1a, 2b`)
81
+ instead of a single number or word?
82
+
83
+ If any answer is "yes" → **collapse to ONE question** and send. Hold
84
+ every other question for its own turn. No exceptions, no "but these
85
+ are related".
86
+
87
+ ### Ordering & handoff
88
+
89
+ - **Session handoff** (`/agent-handoff`, fresh-chat proposal): ask LAST,
90
+ after all domain / clarifying questions — so the user's answers can be
91
+ folded into the handoff prompt. Full rationale in
92
+ [`agent-interaction-and-decision-quality`](../guidelines/agent-infra/agent-interaction-and-decision-quality.md#handoff--model-switch-questions).
93
+ - **Model switch**: different phase — [`model-recommendation`](model-recommendation.md)
94
+ triggers at task start with its own STOP-AND-WAIT gate, standalone, not
95
+ appended to a Q&A block. Do not conflate the two.
96
+ - **Blocking clarification** (can't proceed without it): ask FIRST,
97
+ alone, before any research or planning output.
98
+ - **Optional refinement**: don't ask at all — state the assumption
99
+ and proceed.
47
100
 
48
101
  ## Creating new agent artifacts
49
102
 
@@ -31,8 +31,59 @@ consumer-specific content pollutes downstream or misleads agents.
31
31
  - Always ask when editing package files: "Would this still make sense
32
32
  in a completely different project?"
33
33
 
34
+ ## Runtime invocations — no `task` commands
35
+
36
+ Skills, rules, commands, guidelines, personas, contexts shipped by this
37
+ package run in **consumer projects** that may not have Task installed.
38
+ NEVER reference a `task <name>` invocation inside any artefact file
39
+ under `.agent-src.uncompressed/{skills,rules,commands,guidelines,personas,contexts}/`
40
+ (or the compressed mirror under `.agent-src/`). Use the direct script:
41
+
42
+ | ❌ Forbidden | ✅ Portable |
43
+ |---|---|
44
+ | `task sync` | `bash scripts/compress.sh --sync` |
45
+ | `task sync-check` | `bash scripts/compress.sh --check` |
46
+ | `task sync-check-hashes` | `bash scripts/compress.sh --check-hashes` |
47
+ | `task sync-changed` | `bash scripts/compress.sh --changed` |
48
+ | `task sync-mark-done -- X` | `bash scripts/compress.sh --mark-done X` |
49
+ | `task generate-tools` | `python3 scripts/compress.py --generate-tools` |
50
+ | `task lint-skills` | `python3 scripts/skill_linter.py --all` |
51
+ | `task check-refs` | `python3 scripts/check_references.py` |
52
+ | `task check-portability` | `python3 scripts/check_portability.py` |
53
+ | `task check-compression` | `python3 scripts/check_compression.py` |
54
+ | `task validate-schema` | `python3 scripts/validate_frontmatter.py` |
55
+ | `task counts-check` | `python3 scripts/update_counts.py --check` |
56
+ | `task roadmap-progress` | `./agent-config roadmap:progress` |
57
+ | `task ci` | run each underlying script directly |
58
+
59
+ Task stays a convenience for package maintainers (`Taskfile.yml`,
60
+ `AGENTS.md`, README). Artefact files must assume Task is absent.
61
+
62
+ ## Consumer CLI — `./agent-config`
63
+
64
+ A subset of scripts is exposed through a project-local CLI wrapper
65
+ `./agent-config` (written into the project root by the installer,
66
+ gitignored). Artefacts MUST prefer the CLI over raw `python3 scripts/…`
67
+ paths for every command it covers — raw paths only resolve inside the
68
+ package repo, in consumer projects the scripts live under
69
+ `node_modules/` or `vendor/`.
70
+
71
+ | ❌ Forbidden in artefacts | ✅ Portable |
72
+ |---|---|
73
+ | `python3 scripts/mcp_render.py` | `./agent-config mcp:render` |
74
+ | `python3 scripts/mcp_render.py --check` | `./agent-config mcp:check` |
75
+ | `python3 .augment/scripts/update_roadmap_progress.py` | `./agent-config roadmap:progress` |
76
+ | `python3 .augment/scripts/update_roadmap_progress.py --check` | `./agent-config roadmap:progress-check` |
77
+ | `bash scripts/first-run.sh` | `./agent-config first-run` |
78
+
79
+ Commands not covered by the CLI stay as direct script invocations
80
+ (e.g. `bash scripts/compress.sh --sync`) — maintainer-only, not
81
+ reachable from a consumer project anyway.
82
+
34
83
  ## Enforcement
35
84
 
36
85
  `scripts/check_portability.py` scans `.augment/`, `.agent-src.uncompressed/`,
37
86
  and the package root `AGENTS.md` + `.github/copilot-instructions.md` for
38
- forbidden identifiers. Part of `task ci` must pass before any PR.
87
+ forbidden identifiers, for any `task <name>` invocation, and for direct
88
+ script invocations that bypass the `./agent-config` CLI. Runs in CI —
89
+ must pass before any PR.
@@ -35,7 +35,7 @@ Direct edits to `.agent-src/` break compression hashes, cause CI failures, and c
35
35
 
36
36
  1. **Create or edit** the file in `.agent-src.uncompressed/{path}`
37
37
  2. **Do NOT auto-compress.** Continue working.
38
- 3. **Before commit/push:** Check if compression is needed (`task sync-changed`).
38
+ 3. **Before commit/push:** Check if compression is needed (`bash scripts/compress.sh --changed`).
39
39
  If files need compression, ask the user:
40
40
  ```
41
41
  > 📦 {N} .agent-src files need compression before commit.
@@ -43,9 +43,9 @@ Direct edits to `.agent-src/` break compression hashes, cause CI failures, and c
43
43
  > 1. Compress now — run /compress
44
44
  > 2. Later — commit without compression
45
45
  ```
46
- 4. If compressing: run `/compress` command, then `task sync-mark-done -- {path}`
46
+ 4. If compressing: run `/compress` command, then `bash scripts/compress.sh --mark-done {path}`
47
47
 
48
- For new non-.md files (`.php`, configs): `task sync` copies them automatically.
48
+ For new non-.md files (`.php`, configs): `bash scripts/compress.sh --sync` copies them automatically.
49
49
 
50
50
  **Key change:** Compression happens once before commit/push — not after every edit.
51
51
  This avoids interruptions when work is still in progress.
@@ -88,7 +88,7 @@ disable-model-invocation: true
88
88
  1. Create `.agent-src.uncompressed/commands/{name}.md` (use template)
89
89
  2. Run `python3 scripts/skill_linter.py` — must be 0 FAIL
90
90
  3. Compress via `/compress`, which writes to `.agent-src/commands/`
91
- 4. Run `task generate-tools` — creates Claude symlink automatically
91
+ 4. Run `python3 scripts/compress.py --generate-tools` — creates Claude symlink automatically
92
92
 
93
93
  **Never** create `.claude/skills/{name}/SKILL.md` manually for commands — always use the symlink workflow.
94
94
 
@@ -96,7 +96,7 @@ disable-model-invocation: true
96
96
 
97
97
  Before asking for review or creating a PR, verify derived outputs are not stale:
98
98
 
99
- 1. Run `task sync-changed` — check if `.agent-src.uncompressed/` has changes not yet compressed
99
+ 1. Run `bash scripts/compress.sh --changed` — check if `.agent-src.uncompressed/` has changes not yet compressed
100
100
  2. If stale files exist: run `/compress` before pushing
101
101
  3. Before merge: verify derived outputs (`.agent-src/`, `.augment/`, `.claude/skills/`) are regenerated
102
102
  4. Do NOT leave `.agent-src/` stale across review cycles
@@ -120,9 +120,9 @@ Commands have `disable-model-invocation: true` in their frontmatter.
120
120
  |---|---|
121
121
  | Edit existing file | Edit in `.agent-src.uncompressed/`, compress to `.agent-src/` |
122
122
  | Create new `.md` | Create in `.agent-src.uncompressed/`, compress to `.agent-src/` |
123
- | Create new non-`.md` | Create in `.agent-src.uncompressed/`, run `task sync` |
124
- | Create new command | Create in `.agent-src.uncompressed/commands/`, sync, `task generate-tools` |
123
+ | Create new non-`.md` | Create in `.agent-src.uncompressed/`, run `bash scripts/compress.sh --sync` |
124
+ | Create new command | Create in `.agent-src.uncompressed/commands/`, sync, `python3 scripts/compress.py --generate-tools` |
125
125
  | Delete a file | Delete from `.agent-src.uncompressed/` and `.agent-src/` |
126
- | Check what needs compression | `task sync-changed` |
127
- | Mark file as compressed | `task sync-mark-done -- {path}` |
128
- | Verify everything is in sync | `task sync-check` |
126
+ | Check what needs compression | `bash scripts/compress.sh --changed` |
127
+ | Mark file as compressed | `bash scripts/compress.sh --mark-done {path}` |
128
+ | Verify everything is in sync | `bash scripts/compress.sh --check` |
@@ -0,0 +1,171 @@
1
+ ---
2
+ type: "always"
3
+ description: "Persist the conversation to .agent-chat-history for crash recovery — read on first turn, detect match/returning/foreign/missing, append on progress, honor per-profile frequency and overflow settings"
4
+ alwaysApply: true
5
+ source: package
6
+ ---
7
+
8
+ # Chat History
9
+
10
+ Persists the conversation to `.agent-chat-history` (JSONL, project root,
11
+ git-ignored) so a crashed or switched agent session can be resumed. File
12
+ I/O is owned by [`scripts/chat_history.py`](../../../scripts/chat_history.py)
13
+ — this rule says **when** to call it, not how the file is structured.
14
+
15
+ ## Activation
16
+
17
+ Read `chat_history.*` from `.agent-settings.yml` **once per conversation**
18
+ (first turn). Cache the values.
19
+
20
+ - `chat_history.enabled: false` **or** section missing → rule is a **no-op**
21
+ for the whole conversation. Do not read, write, or mention the file.
22
+ - `chat_history.enabled: true` → cache `frequency`, `max_size_kb`,
23
+ `on_overflow` and proceed to the first-turn handshake.
24
+
25
+ ## First-turn handshake — four states
26
+
27
+ Before executing the user's request, run:
28
+
29
+ ```bash
30
+ scripts/chat_history.py state --first-user-msg "<msg>"
31
+ ```
32
+
33
+ It prints exactly one of `match` | `returning` | `foreign` | `missing`.
34
+ Branch:
35
+
36
+ - `missing` → `init --first-user-msg "<msg>" --freq <frequency>`. Proceed
37
+ silently.
38
+ - `match` → this chat already owns the file. Continue appending as cached.
39
+ - `foreign` → a different session's file. Show **Foreign-Prompt** below.
40
+ - `returning` → this chat once owned the file but another session took
41
+ over. Show **Returning-Prompt** below.
42
+
43
+ In `foreign` and `returning`, **always read the file's current contents
44
+ into the agent's working context before any write** — the user chose to
45
+ log history for a reason; losing it silently is never acceptable.
46
+
47
+ ## Foreign-Prompt — new chat finds existing history
48
+
49
+ Trigger: `state == foreign` **and** `status.entries >= 1`.
50
+
51
+ ```
52
+ > 📒 Found chat history from an unknown session.
53
+ >
54
+ > Header fingerprint: <short-hash-A>
55
+ > Current session: <short-hash-B>
56
+ > Entries on file: <N> Age: <age>
57
+ >
58
+ > 1. Resume — adopt this file, load entries as context, keep appending here
59
+ > 2. New start — archive to .agent-chat-history.bak, init fresh
60
+ > 3. Ignore — leave the file untouched, disable logging for this session
61
+ ```
62
+
63
+ - `1` → `adopt --first-user-msg "<msg>"` (the old fp lands in
64
+ `former_fps` automatically). Read entries into context, then append
65
+ normally.
66
+ - `2` → rename to `.agent-chat-history.bak`, then
67
+ `init --first-user-msg "<msg>" --freq <frequency>`.
68
+ - `3` → logging disabled for this conversation; do not touch the file,
69
+ do not edit settings.
70
+
71
+ Free-text replies ("weiter", "skip it") count as `3`.
72
+
73
+ ## Returning-Prompt — old chat comes back
74
+
75
+ Trigger: `state == returning`. The file exists, its current owner is a
76
+ different session, but this chat's fingerprint is in `former_fps`. The
77
+ agent still has its own in-memory history of the turns it logged before
78
+ the hand-off.
79
+
80
+ ```
81
+ > 📒 Welcome back. This chat once owned the history file; another
82
+ > session has written to it since.
83
+ >
84
+ > On-file entries: <N> Size: <X> KB (now includes <M> foreign entries)
85
+ >
86
+ > (All three options read the on-disk entries into context first.)
87
+ >
88
+ > 1. Merge — my in-memory history first, the foreign entries after,
89
+ > overwrite the file with the combined body
90
+ > 2. Replace — wipe the foreign entries, rewrite the file with my
91
+ > in-memory history only
92
+ > 3. Continue — leave the file as-is; only new entries from now on
93
+ ```
94
+
95
+ - `1` (Merge) → build the in-memory entries list (see below), call
96
+ `prepend --entries-json '<list>'`, then `adopt --first-user-msg "<msg>"`.
97
+ - `2` (Replace) → build the in-memory list,
98
+ `reset --first-user-msg "<msg>" --freq <frequency> --entries-json '<list>'`.
99
+ - `3` (Continue) → `adopt --first-user-msg "<msg>"`, then append normally.
100
+
101
+ Free-text replies count as `3`.
102
+
103
+ ## Building the in-memory entries list (Merge / Replace)
104
+
105
+ The agent reconstructs its own conversation as a JSON array, one entry
106
+ per turn boundary. Keep it compact:
107
+
108
+ - One `{"t":"user","text":"<preview>","ts":"<iso>"}` per user message.
109
+ - One `{"t":"agent","text":"<preview>","ts":"<iso>"}` per agent reply.
110
+ - `text` is a preview — flatten whitespace, cap at ~200 characters. This
111
+ is context, not a transcript.
112
+ - Timestamps in ISO-8601 UTC. If the agent does not have exact times,
113
+ use the current time for all entries; order is what matters.
114
+ - Do **not** include tool-call payloads, file contents, or secrets.
115
+
116
+ If the list is large (>30 KB), pass it via stdin:
117
+ `reset ... --entries-stdin <<< '<list>'`.
118
+
119
+ ## Append cadence — from `frequency`
120
+
121
+ Every append goes through `scripts/chat_history.py append --type <t>
122
+ --json '<obj>'`. Never write the file directly.
123
+
124
+ - `per_turn` — one entry at the end of every agent turn.
125
+ - `per_phase` — at phase boundaries (user question, agent answer,
126
+ decision, completion of a task-list item).
127
+ - `per_tool` — after each tool-call sequence.
128
+
129
+ Entry types: `user`, `agent`, `tool`, `decision`, `phase`. Prefer `phase`
130
+ over `agent` when the entry marks a boundary.
131
+
132
+ ## Overflow — from `on_overflow`
133
+
134
+ When the helper reports file size > `max_size_kb`:
135
+
136
+ - `rotate` → `rotate --mode rotate --max-kb <n>`. Drops oldest entries;
137
+ silent and cheap.
138
+ - `compress` → `rotate --mode compress --max-kb <n>`. Marks the file for
139
+ summarization; the **next** turn writes the summary for the dropped
140
+ range. Do not block the current turn on this.
141
+
142
+ After Merge or Replace rewrites, run the overflow check once — the new
143
+ body may exceed the budget.
144
+
145
+ The setting is stable for the session; never mix modes.
146
+
147
+ ## What this rule does NOT do
148
+
149
+ - Display, reload, or clear the log — that is `/chat-history`,
150
+ `/chat-history-resume`, `/chat-history-clear`.
151
+ - Auto-flip `enabled` or `on_overflow` in settings.
152
+ - Run when `enabled: false`. No silent logging. No telemetry.
153
+ - Decide ownership heuristically. Only the `state` helper does that.
154
+
155
+ ## Interactions
156
+
157
+ - `ask-when-uncertain` + `user-interaction` — foreign/returning prompts
158
+ use numbered options, one question per turn.
159
+ - `language-and-tone` — prompt translated at runtime; `.md` stays English.
160
+ - `onboarding-gate` — runs first; this rule activates only after it clears.
161
+ - `token-efficiency` — never load the full log into context from this
162
+ rule; use `status` for metadata, `read --last N` for a tail.
163
+
164
+ ## See also
165
+
166
+ - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — file API
167
+ - [`/chat-history`](../commands/chat-history.md) — status inspection
168
+ - [`/chat-history-resume`](../commands/chat-history-resume.md) — adopt + load
169
+ - [`/chat-history-clear`](../commands/chat-history-clear.md) — wipe
170
+ - [`agent-settings` template](../templates/agent-settings.md) — `chat_history.*` reference
171
+ - [`rule-type-governance`](rule-type-governance.md) — why this is `always`
@@ -44,12 +44,10 @@ docker compose exec -T <php-service> vendor/bin/phpunit
44
44
 
45
45
  ## Build / Task Runner
46
46
 
47
- Before using raw `docker compose exec` commands, check if a `Makefile` or `Taskfile.yml` exists.
48
- These often provide convenient shortcuts for common operations:
49
-
50
- - `Makefile` `make console`, `make test`, `make phpstan`, etc.
51
- - `Taskfile.yml` `task console`, `task test`, `task phpstan`, etc.
52
-
53
- **Always read the Makefile/Taskfile first** to discover available targets.
47
+ Before using raw `docker compose exec`, check if the consumer project
48
+ ships a `Makefile` it often wraps common ops (`make console`,
49
+ `make test`, `make phpstan`). Read the Makefile first. If the project
50
+ uses another task runner, inspect its config before falling back to
51
+ raw `docker compose exec`.
54
52
 
55
53
  Frontend commands (npm, webpack) run on the host or in the node container.
@@ -47,15 +47,19 @@ When a skill is **added or its scope changes**, check and update:
47
47
 
48
48
  ## Settings template sync
49
49
 
50
- When skill/rule/command reads new setting from `.agent-settings.yml` not in `templates/agent-settings.md`:
51
-
52
- 1. Add key with default to template
53
- 2. Add row to Settings Reference table
54
- 3. Add comment above key explaining it
55
- 4. **Update local `.agent-settings.yml`** add new key with default, preserve existing values,
56
- apply template order and comments. Same behavior as `/config-agent-settings`, inline.
57
-
58
- **Mandatory** without step 4, user can't discover new settings exist.
50
+ When a skill, rule, or command **reads a new setting** from `.agent-settings.yml` that does not yet
51
+ exist in `.augment/templates/agent-settings.md`:
52
+
53
+ 1. **Add the key** with its default value to the template block.
54
+ 2. **Add a row** to the Settings Reference table.
55
+ 3. **Add a comment** above the key explaining what it does.
56
+ 4. **Update the local `.agent-settings.yml`** add the new key with its default value.
57
+ Preserve all existing values, apply template order and comments. Follow the
58
+ [section-aware merge rules](../guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)
59
+ so the user benefits immediately without running a separate command.
60
+
61
+ **This step is mandatory.** If the template gains a new key but the local `.agent-settings.yml`
62
+ is not updated, the user cannot discover the new setting exists.
59
63
 
60
64
  ## Content consistency
61
65
 
@@ -40,8 +40,10 @@ Before coding, quickly verify:
40
40
  - Does similar functionality already exist?
41
41
  - Does it follow established patterns in the codebase?
42
42
  - Does it contradict existing conventions?
43
+ - Do **multiple valid patterns/frameworks** already exist (Tailwind + Flux, multiple form libs, competing state stores)? If yes → do NOT pick arbitrarily, ask.
43
44
 
44
45
  **If misfit** → show evidence (file references), propose alternative.
46
+ **If multiple valid options** → list them, ask which. See [`no blind implementation`](../guidelines/agent-infra/agent-interaction-and-decision-quality.md#2-no-blind-implementation).
45
47
 
46
48
  ### 3. Is the approach sound?
47
49
 
@@ -0,0 +1,94 @@
1
+ ---
2
+ type: "always"
3
+ description: "First-run gate — when onboarding.onboarded is false in .agent-settings.yml, prompt the user to run /onboard before anything else"
4
+ alwaysApply: true
5
+ source: package
6
+ ---
7
+
8
+ # Onboarding Gate
9
+
10
+ Forces a one-time `/onboard` run for each developer on each project. This
11
+ replaces the previously scattered "ask once" patterns across `user_name`,
12
+ `personal.ide`, `personal.rtk_installed`, and cost profile confirmation.
13
+
14
+ ## When to activate
15
+
16
+ Read `onboarding.onboarded` from `.agent-settings.yml` **once per
17
+ conversation**, on the very first agent turn.
18
+
19
+ - Key missing entirely → **legacy project**. Treat as onboarded, do
20
+ nothing. Do not write the key.
21
+ - `true` → do nothing. Rule is inert for the rest of the conversation.
22
+ - `false` → gate is active for this conversation (see below).
23
+
24
+ Cache the result for the whole conversation. Do not re-read on every turn.
25
+
26
+ ## Gate behavior when `onboarded: false`
27
+
28
+ On the **first** turn of the conversation, before executing the user's
29
+ request, emit this prompt and stop:
30
+
31
+ ```
32
+ > 👋 First-run setup hasn't been completed for this project.
33
+ >
34
+ > Run /onboard once (≈2 minutes) to capture:
35
+ > • your name, IDE, and rtk status
36
+ > • cost profile + learning loop confirmation
37
+ >
38
+ > 1. Run /onboard now
39
+ > 2. Skip — mark as onboarded and continue with the request
40
+ > 3. Snooze — continue just this turn; ask again next conversation
41
+ ```
42
+
43
+ - `1` → invoke `/onboard`. Resume the user's original request afterwards.
44
+ - `2` → set `onboarding.onboarded: true` in `.agent-settings.yml` (touch
45
+ only that field; preserve comments and order). Then execute the
46
+ original request.
47
+ - `3` → proceed with the original request. Do not ask again in this
48
+ conversation. Do not write the file.
49
+
50
+ Free-text replies (`"mach weiter"`, `"just do it"`) count as `3`.
51
+
52
+ ## Exceptions — do NOT block
53
+
54
+ Skip the gate when the user's request already is an onboarding or
55
+ settings operation, so we don't prompt users mid-setup:
56
+
57
+ - `/onboard`, `/set-cost-profile`, `/mode`
58
+ - The user explicitly asks about `.agent-settings.yml` or onboarding
59
+ - Incident / break-glass signals (`hotfix`, `break-glass`, `"prod is
60
+ down"`). The gate waits for normal operations to resume.
61
+
62
+ ## Non-blocking for legacy projects
63
+
64
+ If `.agent-settings.yml` exists but has no `onboarding` section at all,
65
+ treat as onboarded. Only `onboarded: false` (explicit) triggers the
66
+ gate. This protects projects that were set up before this rule shipped.
67
+
68
+ ## What this rule does NOT do
69
+
70
+ - Write `onboarded: true` automatically. Only `/onboard` (step 6) and
71
+ the user's explicit `2` choice do that.
72
+ - Re-prompt across turns in the same conversation. One prompt per
73
+ conversation, max.
74
+ - Replace normal settings edits. Mid-life changes are ad-hoc (edit the
75
+ file directly or ask the agent, which follows
76
+ [`layered-settings`](../guidelines/agent-infra/layered-settings.md#section-aware-merge-rules));
77
+ this rule is a one-time gate.
78
+ - Run on every agent turn. First turn only.
79
+
80
+ ## Interactions
81
+
82
+ - `ask-when-uncertain` — the gate uses its numbered-options iron law;
83
+ one question per turn.
84
+ - `language-and-tone` — prompt is translated to the user's language at
85
+ runtime; `.md` source stays English.
86
+ - `scope-control` — option `2` writes exactly one key; no side effects.
87
+ - `role-mode-adherence` — gate runs BEFORE the mode marker is emitted.
88
+
89
+ ## See also
90
+
91
+ - [`/onboard`](../commands/onboard.md) — the command this gate invokes
92
+ - [`layered-settings`](../guidelines/agent-infra/layered-settings.md) — merge rules for mid-life edits
93
+ - [`agent-settings` template](../templates/agent-settings.md) — `onboarding.onboarded` reference
94
+ - [`rule-type-governance`](rule-type-governance.md) — why this is `always`
@@ -18,8 +18,8 @@ NEVER push without running ALL CI checks locally first.
18
18
  ### 1. Sync
19
19
 
20
20
  ```bash
21
- task sync-check # .agent-src/ matches .agent-src.uncompressed/
22
- task sync-check-hashes # compression hashes are clean
21
+ bash scripts/compress.sh --check # .agent-src/ matches .agent-src.uncompressed/
22
+ bash scripts/compress.sh --check-hashes # compression hashes are clean
23
23
  ```
24
24
 
25
25
  ### 2. Consistency
@@ -51,7 +51,8 @@ python3 scripts/readme_linter.py README.md --root .
51
51
  ## Quick one-liner
52
52
 
53
53
  ```bash
54
- task sync-check && task sync-check-hashes && \
54
+ bash scripts/compress.sh --check && \
55
+ bash scripts/compress.sh --check-hashes && \
55
56
  python3 scripts/check_compression.py && \
56
57
  python3 scripts/check_references.py && \
57
58
  python3 scripts/check_portability.py && \
@@ -64,8 +65,8 @@ python3 scripts/readme_linter.py README.md --root .
64
65
 
65
66
  1. Edit uncompressed file
66
67
  2. Edit compressed file in `.agent-src/` to match
67
- 3. `task sync-mark-done -- {relative-path}` — update hash
68
- 4. `task sync-check-hashes` — verify
68
+ 3. `bash scripts/compress.sh --mark-done {relative-path}` — update hash
69
+ 4. `bash scripts/compress.sh --check-hashes` — verify
69
70
 
70
71
  **Skip step 3 → CI WILL fail.**
71
72