@event4u/agent-config 1.19.0 → 1.20.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 (88) hide show
  1. package/.agent-src/commands/agent-handoff.md +14 -10
  2. package/.agent-src/commands/chat-history/import.md +170 -0
  3. package/.agent-src/commands/chat-history/learn.md +178 -0
  4. package/.agent-src/commands/chat-history/show.md +17 -18
  5. package/.agent-src/commands/chat-history.md +26 -25
  6. package/.agent-src/commands/council/default.md +4 -7
  7. package/.agent-src/commands/create-pr.md +28 -8
  8. package/.agent-src/commands/sync-gitignore.md +1 -1
  9. package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +76 -0
  10. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +3 -3
  11. package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +5 -12
  12. package/.agent-src/rules/direct-answers.md +10 -2
  13. package/.agent-src/rules/language-and-tone.md +37 -6
  14. package/.agent-src/rules/no-attribution-footers.md +48 -0
  15. package/.agent-src/rules/no-roadmap-references.md +1 -1
  16. package/.agent-src/rules/skill-quality.md +49 -0
  17. package/.agent-src/rules/user-interaction.md +21 -5
  18. package/.agent-src/skills/ai-council/SKILL.md +4 -5
  19. package/.agent-src/skills/dcf-modeling/SKILL.md +89 -0
  20. package/.agent-src/skills/funnel-analysis/SKILL.md +100 -0
  21. package/.agent-src/skills/md-language-check/SKILL.md +1 -1
  22. package/.agent-src/skills/okr-tree-modeling/SKILL.md +93 -0
  23. package/.agent-src/skills/rice-prioritization/SKILL.md +100 -0
  24. package/.agent-src/skills/subagent-orchestration/SKILL.md +34 -2
  25. package/.agent-src/skills/unit-economics-modeling/SKILL.md +104 -0
  26. package/.agent-src/skills/using-git-worktrees/SKILL.md +1 -0
  27. package/.agent-src/templates/agent-settings.md +5 -26
  28. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +7 -5
  29. package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +0 -4
  30. package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +0 -4
  31. package/.agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +7 -51
  32. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +1 -2
  33. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +1 -2
  34. package/.agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +2 -3
  35. package/.agent-src/templates/skill.md +30 -1
  36. package/.claude-plugin/marketplace.json +8 -4
  37. package/AGENTS.md +44 -3
  38. package/CHANGELOG.md +111 -0
  39. package/README.md +6 -6
  40. package/config/agent-settings.template.yml +19 -13
  41. package/config/gitignore-block.txt +4 -4
  42. package/docs/architecture.md +3 -3
  43. package/docs/catalog.md +14 -12
  44. package/docs/contracts/adr-chat-history-split.md +10 -1
  45. package/docs/contracts/command-clusters.md +1 -1
  46. package/docs/contracts/cross-wing-handoff.md +133 -0
  47. package/docs/contracts/file-ownership-matrix.json +341 -126
  48. package/docs/contracts/hook-architecture-v1.md +8 -1
  49. package/docs/contracts/memory-visibility-v1.md +8 -24
  50. package/docs/customization.md +1 -1
  51. package/docs/getting-started.md +21 -29
  52. package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +1 -1
  53. package/docs/hook-payload-capture.md +221 -0
  54. package/docs/migrations/commands-1.15.0.md +17 -12
  55. package/docs/skills-catalog.md +5 -4
  56. package/llms.txt +4 -3
  57. package/package.json +1 -1
  58. package/scripts/agent-config +1 -1
  59. package/scripts/ai_council/_default_prices.py +4 -4
  60. package/scripts/ai_council/clients.py +1 -1
  61. package/scripts/ai_council/modes.py +3 -4
  62. package/scripts/ai_council/pricing.py +10 -9
  63. package/scripts/build_rule_trigger_matrix.py +1 -9
  64. package/scripts/chat_history.py +952 -596
  65. package/scripts/check_references.py +12 -2
  66. package/scripts/council_cli.py +54 -4
  67. package/scripts/hook_manifest.yaml +33 -0
  68. package/scripts/hooks/augment-chat-history.sh +10 -0
  69. package/scripts/hooks/cowork-dispatcher.sh +98 -0
  70. package/scripts/hooks/dispatch_hook.py +35 -0
  71. package/scripts/hooks_status.py +12 -1
  72. package/scripts/install-hooks.sh +2 -2
  73. package/scripts/install.sh +37 -0
  74. package/scripts/lint_handoffs.py +214 -0
  75. package/scripts/lint_hook_manifest.py +2 -1
  76. package/scripts/redact_hook_capture.py +148 -0
  77. package/scripts/schemas/skill.schema.json +5 -0
  78. package/scripts/skill_linter.py +163 -1
  79. package/scripts/update_prices.py +3 -3
  80. package/.agent-src/commands/chat-history/checkpoint.md +0 -126
  81. package/.agent-src/commands/chat-history/clear.md +0 -103
  82. package/.agent-src/commands/chat-history/resume.md +0 -183
  83. package/.agent-src/rules/chat-history-cadence.md +0 -143
  84. package/.agent-src/rules/chat-history-ownership.md +0 -124
  85. package/.agent-src/rules/chat-history-visibility.md +0 -97
  86. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_heartbeat.py +0 -50
  87. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_turn_check.py +0 -49
  88. package/scripts/check_phase_coupling.py +0 -148
@@ -66,17 +66,21 @@ Show the handoff prompt in a fenced code block and say:
66
66
  - **Decisions are important** — prevents the new chat from re-asking settled questions.
67
67
  - **File list is optional** — only include if the new chat will need to edit specific files.
68
68
 
69
- ## When to use this vs. `/chat-history-resume`
69
+ ## When to use this vs. `agents/.agent-chat-history`
70
70
 
71
71
  - `/agent-handoff` is **push-based**: you copy a short summary into the
72
72
  new chat. Works across tools (Augment → Claude Code), across machines,
73
73
  and without any persistent file.
74
- - [`/chat-history-resume`](chat-history-resume.md) is **pull-based**: the
75
- new chat reads `.agent-chat-history` from disk (written by the
76
- [`chat-history`](../rules/chat-history-ownership.md) rule). Works only on the
77
- same machine and same repo, but captures more detail (every phase /
78
- tool call / decision the prior session logged).
79
-
80
- Prefer `/agent-handoff` for planned context switches; prefer
81
- `/chat-history-resume` after a crash or after switching tools within the
82
- same workspace.
74
+ - `agents/.agent-chat-history` is **pull-based** and **multi-session**: every
75
+ session writes its own entries tagged with a 16-char session
76
+ fingerprint derived from the platform `session_id` (schema v4, see
77
+ [`chat-history-platform-hooks`](../../agents/contexts/chat-history-platform-hooks.md)).
78
+ Works only on the same machine and same repo, but captures every
79
+ phase / decision any session logged. Inspect with `/chat-history show`;
80
+ pull prior-session context into the current chat verbatim with
81
+ `/chat-history import`; mine a prior session for project-improving
82
+ learnings with `/chat-history learn`.
83
+
84
+ Prefer `/agent-handoff` for planned context switches across tools or
85
+ machines; use `/chat-history import` after a crash or fresh-chat reopen
86
+ on the same workspace to surface prior-session context verbatim.
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: chat-history:import
3
+ cluster: chat-history
4
+ sub: import
5
+ description: Surface prior chat-history sessions as numbered options, let the user pick exactly one, then render its entries verbatim into the current chat — selective, user-driven cross-session import
6
+ disable-model-invocation: true
7
+ suggestion:
8
+ eligible: true
9
+ trigger_description: "import a past session into the current chat, pull a prior session into context, pick a session to read"
10
+ trigger_context: "user wants to selectively pull verbatim context from one earlier session into the current one"
11
+ ---
12
+ <!-- cloud_safe: noop -->
13
+
14
+ # /chat-history import
15
+
16
+ Read-only, **user-driven** cross-session import. Surfaces prior
17
+ sessions logged in `agents/.agent-chat-history` as numbered options, the
18
+ user picks **one**, the agent reads that session's entries
19
+ **verbatim** and renders them in the chat. Any subsequent
20
+ extraction or summarisation happens in dialogue, user-directed —
21
+ the agent does **not** auto-summarise, auto-import, or rewrite the
22
+ user's context (Council Round 2 / R2-2 — verbatim is the honest v1
23
+ contract).
24
+
25
+ This is the opt-in counterpart to the read-path filter (Phase 3 of
26
+ `road-to-chat-history-session-isolation`): default reads stay
27
+ session-scoped; `import` is the explicit surface for crossing the
28
+ session boundary verbatim. For project-improving learnings derived
29
+ from a prior session, see [`/chat-history learn`](learn.md).
30
+
31
+ ## When NOT to use
32
+
33
+ - Inspect the current session — that is the default of
34
+ `/chat-history show` plus `scripts/chat_history.py read`.
35
+ - Generate a learning proposal from a prior session — use
36
+ [`/chat-history learn`](learn.md), which orchestrates
37
+ `learning-to-rule-or-skill` on the picked session.
38
+ - Bulk-import all sessions — out of scope for v1. One session per
39
+ invocation; multi-pick is v2.
40
+ - Search prior sessions by content — out of scope for v1; no fuzzy
41
+ search, no full-text grep. The user picks by `last_ts` and
42
+ `summary` from the listing.
43
+
44
+ ## Steps
45
+
46
+ ### 1. Check if enabled
47
+
48
+ Read `chat_history.enabled` from `.agent-settings.yml`. If `false`
49
+ or the section is missing, say so and stop:
50
+
51
+ ```
52
+ > 📒 chat-history is disabled (chat_history.enabled = false).
53
+ > Set it to true in .agent-settings.yml to start logging.
54
+ ```
55
+
56
+ ### 2. List sessions
57
+
58
+ Run `scripts/chat_history.py sessions --json --limit 20 --summary`.
59
+ The helper returns an array of
60
+ `{id, count, first_ts, last_ts, preview, summary}` sorted by
61
+ `last_ts` desc. The `summary` field is built **inside the helper**
62
+ from at most 10 sampled entries per session (5 oldest + 5 newest) —
63
+ token-cheap, no need to ever read the full body for the picker.
64
+ Default excludes empty buckets — only sessions with at least one
65
+ body entry are surfaced.
66
+
67
+ If the array is empty, stop:
68
+
69
+ ```
70
+ > 📒 No prior sessions found in agents/.agent-chat-history.
71
+ ```
72
+
73
+ ### 3. Surface as numbered options
74
+
75
+ Render each session as a numbered option (per the `user-interaction`
76
+ rule — Iron Law: numbered options for any picker). Lead with the
77
+ helper's `summary` field — that is the rough arc the user picks by
78
+ (`<first user msg> → <last user msg>` for normal sessions, or
79
+ `(N entries — no user prompts; t-mix: …)` for tool-only sessions).
80
+ The session `id` is noise to humans; keep it **internal** for step
81
+ 5's `read --session <id>` call and never render it in the listing.
82
+ Format:
83
+
84
+ ```
85
+ > Pick a session to import verbatim:
86
+ >
87
+ > 1. {summary}
88
+ > {YYYY-MM-DD HH:MM} · {count} entries
89
+ > 2. ...
90
+ > ...
91
+ > N. abort — do not read any session
92
+ ```
93
+
94
+ Format the timestamp as `YYYY-MM-DD HH:MM` (drop seconds and
95
+ timezone — the listing is for orientation, not forensics). Do
96
+ **not** truncate or rewrite `summary` — the helper already shapes
97
+ it. Always include an explicit abort option as the last numbered
98
+ choice. Track option-number → `id` internally so step 5 can call
99
+ `scripts/chat_history.py read --session <id>` with the right id.
100
+
101
+ ### 4. Wait for the pick
102
+
103
+ **One question per turn** (per `ask-when-uncertain`). Do not chain
104
+ the listing with anything else; do not auto-pick; do not surface a
105
+ default. Wait for the user's response.
106
+
107
+ If the user picks the abort option, stop without reading.
108
+
109
+ ### 5. Read the picked session verbatim
110
+
111
+ Run `scripts/chat_history.py read --session <id>` with the picked
112
+ `id`. The helper returns the entries as JSON.
113
+
114
+ Render them **verbatim** in the chat — do not summarise, do not
115
+ re-format, do not drop fields. One entry per line is acceptable;
116
+ preserve `t`, `text`, `name`, `ts`, and any other fields the helper
117
+ emits. Use a fenced block so timestamps and JSON survive markdown
118
+ rendering:
119
+
120
+ ````
121
+ > 📒 Session {id} — {count} entries
122
+
123
+ ```json
124
+ {...entry 1...}
125
+ {...entry 2...}
126
+ ...
127
+ ```
128
+ ````
129
+
130
+ If the session is large (>50 entries), still render verbatim — but
131
+ prepend a one-line note that the listing is long, so the user can
132
+ scroll. Do not silently truncate.
133
+
134
+ ### 6. Hand back
135
+
136
+ After rendering, **do not** auto-act on the content. Hand back to
137
+ the user with a short prompt:
138
+
139
+ ```
140
+ > Picked session is rendered above. What would you like to extract?
141
+ ```
142
+
143
+ Any follow-up (extract decisions, copy specific entries into the
144
+ current session, etc.) is user-directed in subsequent turns. The
145
+ agent does not write to the current session's log on the user's
146
+ behalf without an explicit instruction.
147
+
148
+ ## Gotchas
149
+
150
+ - **Verbatim, not structured.** Council Round 2 (R2-2) resolved an
151
+ earlier contradiction in favour of verbatim. Do not "helpfully"
152
+ pre-summarise — the user reads the source, then directs the
153
+ extraction.
154
+ - **One pick per invocation.** Multi-pick is v2. If the user wants
155
+ a second session, run `/chat-history import` again.
156
+ - **Read-only.** This command never writes to `agents/.agent-chat-history`
157
+ and never rotates.
158
+ - **`<legacy>` and `<unknown>` buckets** show up like any other
159
+ session id when they have body entries — the user can pick them
160
+ too. The helper aggregates body entries with no `s` field into
161
+ `<legacy>` and entries with `s == "<unknown>"` into `<unknown>`.
162
+
163
+ ## See also
164
+
165
+ - [`/chat-history learn`](learn.md) — pick a prior session and turn it into a project-improving proposal via `learning-to-rule-or-skill`
166
+ - [`/chat-history show`](show.md) — current-session inspector
167
+ - [`chat-history-platform-hooks`](../../../agents/contexts/chat-history-platform-hooks.md) — read contract, isolation default, opt-in cross-session path
168
+ - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — `sessions` and `read --session` CLI surface
169
+ - [`user-interaction`](../../rules/user-interaction.md) — numbered-options Iron Law
170
+ - [`ask-when-uncertain`](../../rules/ask-when-uncertain.md) — one-question-per-turn Iron Law
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: chat-history:learn
3
+ cluster: chat-history
4
+ sub: learn
5
+ skills: [learning-to-rule-or-skill]
6
+ description: Pick a prior chat-history session and mine it for project-improving learnings — runs learning-to-rule-or-skill on the picked session, drafts proposal(s) under agents/proposals/
7
+ disable-model-invocation: true
8
+ suggestion:
9
+ eligible: true
10
+ trigger_description: "extract a learning from a past session, mine chat-history for proposals, what did we learn last session, codify a pattern from a prior session"
11
+ trigger_context: "user wants to derive a rule/skill/guideline proposal from the content of one prior session"
12
+ ---
13
+ <!-- cloud_safe: noop -->
14
+
15
+ # /chat-history learn
16
+
17
+ User-driven **learning extraction** from a prior session. Surfaces
18
+ prior sessions logged in `agents/.agent-chat-history` as numbered options,
19
+ the user picks **one**, the agent reads that session's entries and
20
+ runs the [`learning-to-rule-or-skill`](../../skills/learning-to-rule-or-skill/SKILL.md)
21
+ workflow on the content — surfacing repeated mistakes, successful
22
+ patterns, or constraints worth codifying as a rule, skill, or
23
+ guideline proposal.
24
+
25
+ This is the **project-improvement** counterpart to
26
+ [`/chat-history import`](import.md): `import` renders a session
27
+ verbatim into the current chat for the user to act on; `learn`
28
+ mines a session for proposals that improve the agent or the
29
+ project itself.
30
+
31
+ ## When NOT to use
32
+
33
+ - Pull a prior session into the current chat verbatim — use
34
+ [`/chat-history import`](import.md).
35
+ - Capture a learning that originated **in the current** session —
36
+ invoke the [`learning-to-rule-or-skill`](../../skills/learning-to-rule-or-skill/SKILL.md)
37
+ skill directly. `learn` is for prior-session mining only.
38
+ - Bulk-mine all sessions — out of scope for v1. One session per
39
+ invocation; multi-pick is v2.
40
+
41
+ ## Steps
42
+
43
+ ### 1. Check if enabled
44
+
45
+ Read `chat_history.enabled` from `.agent-settings.yml`. If `false`
46
+ or the section is missing, say so and stop:
47
+
48
+ ```
49
+ > 📒 chat-history is disabled (chat_history.enabled = false).
50
+ > Set it to true in .agent-settings.yml to start logging.
51
+ ```
52
+
53
+ ### 2. List sessions
54
+
55
+ Run `scripts/chat_history.py sessions --json --limit 20 --summary`.
56
+ The helper returns an array of
57
+ `{id, count, first_ts, last_ts, preview, summary}` sorted by
58
+ `last_ts` desc. The `summary` field is built inside the helper
59
+ from ≤10 sampled entries per session (5 oldest + 5 newest) —
60
+ token-cheap, no full-body read needed for the picker. Empty
61
+ buckets are excluded by default.
62
+
63
+ If the array is empty, stop:
64
+
65
+ ```
66
+ > 📒 No prior sessions found in agents/.agent-chat-history.
67
+ ```
68
+
69
+ ### 3. Surface as numbered options
70
+
71
+ Render each session as a numbered option (per the `user-interaction`
72
+ rule — Iron Law: numbered options for any picker). Lead with the
73
+ helper's `summary` field — the rough arc the user picks by
74
+ (`<first user msg> → <last user msg>`, or
75
+ `(N entries — no user prompts; t-mix: …)` for tool-only sessions).
76
+ Keep the session `id` **internal** for step 5's `read --session <id>`
77
+ call; never render it in the listing. Format:
78
+
79
+ ```
80
+ > Pick a session to mine for learnings:
81
+ >
82
+ > 1. {summary}
83
+ > {YYYY-MM-DD HH:MM} · {count} entries
84
+ > 2. ...
85
+ > ...
86
+ > N. abort — do not extract any learning
87
+ ```
88
+
89
+ Format the timestamp as `YYYY-MM-DD HH:MM` (drop seconds + timezone
90
+ — orientation, not forensics). Do not truncate or rewrite `summary`
91
+ — the helper already shapes it. Always include an explicit abort
92
+ option last. Track option-number → `id` internally so step 5 calls
93
+ `scripts/chat_history.py read --session <id>` with the right id.
94
+
95
+ ### 4. Wait for the pick
96
+
97
+ **One question per turn** (per `ask-when-uncertain`). Do not chain
98
+ the listing with anything else; do not auto-pick; do not surface a
99
+ default. Wait for the user's response.
100
+
101
+ If the user picks the abort option, stop without reading.
102
+
103
+ ### 5. Read the picked session
104
+
105
+ Run `scripts/chat_history.py read --session <id>` with the picked
106
+ `id`. Hold the entries in working memory — do **not** render them
107
+ verbatim into the chat. The verbatim path is `import`'s job; here
108
+ the entries are input to step 6.
109
+
110
+ ### 6. Run `learning-to-rule-or-skill`
111
+
112
+ Apply the [`learning-to-rule-or-skill`](../../skills/learning-to-rule-or-skill/SKILL.md)
113
+ procedure on the session content:
114
+
115
+ 1. **Scan** the entries for candidate learnings — repeated
116
+ mistakes, successful patterns, friction points, or constraints
117
+ stated by the user.
118
+ 2. **Pass each candidate through the Promotion Gate** (§ 0 of the
119
+ skill): repetition, impact, failure pattern, non-duplication,
120
+ scope fit, minimal. Drop candidates that fail any gate.
121
+ 3. **For each surviving candidate**, run § 4 (search protocol — all
122
+ four steps), then decide rule / skill / guideline / update / no
123
+ action per § 3 of the skill.
124
+ 4. **Draft a proposal** for every candidate that warrants one,
125
+ following § 8 of the skill (proposal template under
126
+ `agents/proposals/<id>.md`).
127
+
128
+ If multiple candidates survive, draft them as **separate**
129
+ proposals — do not merge unrelated learnings into one.
130
+
131
+ ### 7. Surface the result
132
+
133
+ Hand back to the user with a structured summary per surviving
134
+ candidate:
135
+
136
+ ```
137
+ > 📒 Mined session {id} — {N} candidate(s) surfaced
138
+
139
+ > 1. {learning title}
140
+ > Decision: {rule|skill|guideline|update|no action}
141
+ > Proposal: agents/proposals/{proposal_id}.md
142
+ > Gate: {pass|fail — reason}
143
+ > 2. ...
144
+ ```
145
+
146
+ If no candidate cleared the Promotion Gate, say so explicitly:
147
+
148
+ ```
149
+ > 📒 Mined session {id} — no candidate cleared the Promotion Gate.
150
+ ```
151
+
152
+ Do **not** open a PR, do **not** commit the proposals — proposal
153
+ files land in `agents/proposals/` (gitignored or curated per
154
+ project policy) for the user to review and route via
155
+ `upstream-contribute` or merge into `agents/overrides/`.
156
+
157
+ ## Gotchas
158
+
159
+ - **Promotion Gate is hard.** A grep miss is not proof of
160
+ non-duplication — § 4 of the skill mandates the four-step search
161
+ protocol. Do not skip it.
162
+ - **One pick per invocation.** Multi-pick is v2. If the user wants
163
+ to mine a second session, run `/chat-history learn` again.
164
+ - **Read-only on the log.** This command never writes to
165
+ `agents/.agent-chat-history`. It writes proposal drafts under
166
+ `agents/proposals/` only.
167
+ - **No auto-promotion.** Drafted proposals stay in `proposals/`
168
+ until the user routes them. `learn` never invokes
169
+ `upstream-contribute` itself.
170
+
171
+ ## See also
172
+
173
+ - [`/chat-history import`](import.md) — verbatim render of a prior session
174
+ - [`learning-to-rule-or-skill`](../../skills/learning-to-rule-or-skill/SKILL.md) — the workflow this command orchestrates
175
+ - [`upstream-contribute`](../../skills/upstream-contribute/SKILL.md) — promote a project-scoped proposal upstream
176
+ - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — `sessions` and `read --session` CLI surface
177
+ - [`user-interaction`](../../rules/user-interaction.md) — numbered-options Iron Law
178
+ - [`ask-when-uncertain`](../../rules/ask-when-uncertain.md) — one-question-per-turn Iron Law
@@ -11,14 +11,15 @@ suggestion:
11
11
  <!-- cloud_safe: noop -->
12
12
 
13
13
  # /chat-history show
14
- Inspect `.agent-chat-history` — the JSONL log maintained by the
15
- [`chat-history`](../rules/chat-history-ownership.md) rule for crash recovery.
14
+ Inspect `agents/.agent-chat-history` — the JSONL log appended by the
15
+ structural chat-history hooks (`ChatHistoryAppendHook`,
16
+ `ChatHistoryHaltAppendHook`) for crash recovery.
16
17
 
17
18
  Shows:
18
19
 
19
20
  - Whether the file exists and whether logging is currently enabled
20
21
  - File size vs `max_size_kb`
21
- - Header metadata: fingerprint preview, created-at, `frequency`
22
+ - Header metadata: schema version, `started`, `frequency`
22
23
  - Entry count and age of the oldest/newest entry
23
24
  - A peek at the last 3–5 entries so the user can see what was captured
24
25
 
@@ -26,9 +27,8 @@ Read-only — this command never writes to the file.
26
27
 
27
28
  ## When NOT to use
28
29
 
29
- - Load the log back into the conversation for context →
30
- [`/chat-history resume`](chat-history-resume.md).
31
- - Wipe the file → [`/chat-history clear`](chat-history-clear.md).
30
+ - Wipe the file delete `agents/.agent-chat-history` manually; it is
31
+ git-ignored and will be recreated on the next hook fire.
32
32
  - Configure logging behavior → edit `.agent-settings.yml` directly
33
33
  (`chat_history.*`); see
34
34
  [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
@@ -66,10 +66,10 @@ Render a concise report:
66
66
  ```
67
67
  > 📒 chat-history status
68
68
  >
69
- > File: .agent-chat-history ({size_kb} KB / {max_size_kb} KB)
69
+ > File: agents/.agent-chat-history ({size_kb} KB / {max_size_kb} KB)
70
70
  > Entries: {entries}
71
- > Fingerprint:{short_fp} (session started {created_at_relative})
72
- > Frequency: {frequency}
71
+ > Schema: v{header.v} (started {header.started})
72
+ > Frequency: {header.freq}
73
73
  > Overflow: {on_overflow}
74
74
  >
75
75
  > Last entries:
@@ -84,15 +84,16 @@ data, see [`token-efficiency`](../rules/token-efficiency.md)).
84
84
 
85
85
  ### 5. Offer follow-ups (optional)
86
86
 
87
- If the file exists and the fingerprint does **not** match the current
88
- session, suggest `/chat-history resume` to adopt it.
89
-
90
87
  If the file is close to `max_size_kb` (> 80 %), mention it — the next
91
- append may trigger overflow handling.
88
+ append may trigger overflow handling. To pull a specific prior
89
+ session into the current chat verbatim, point the user at
90
+ `/chat-history import`; to mine a prior session for project-improving
91
+ learnings, `/chat-history learn`. The body filter on `s` is the v4
92
+ isolation surface in both cases.
92
93
 
93
94
  ## Gotchas
94
95
 
95
- - `.agent-chat-history` is git-ignored. This command never commits.
96
+ - `agents/.agent-chat-history` is git-ignored. This command never commits.
96
97
  - The helper is the only way to read the file — do not cat or parse
97
98
  the JSONL directly; entry shape is owned by `scripts/chat_history.py`.
98
99
  - If `exists: false` but the rule says logging is enabled, the file is
@@ -100,8 +101,6 @@ append may trigger overflow handling.
100
101
 
101
102
  ## See also
102
103
 
103
- - [`chat-history`](../rules/chat-history-ownership.md) — the rule that writes the file
104
- - [`/chat-history resume`](chat-history-resume.md) — adopt + load
105
- - [`/chat-history clear`](chat-history-clear.md) — wipe
104
+ - [`chat-history-platform-hooks`](../../../agents/contexts/chat-history-platform-hooks.md) — the hook-only contract
106
105
  - [`agent-settings` template](../templates/agent-settings.md) — `chat_history.*` reference
107
- - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — helper API
106
+ - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — helper API (`status`, `read`, `sessions`, `prune-sessions`)
@@ -1,51 +1,52 @@
1
1
  ---
2
2
  name: chat-history
3
- description: Chat-history orchestrator — routes to show, resume, clear, checkpoint
3
+ description: Chat-history orchestrator — routes to show, import, learn
4
4
  cluster: chat-history
5
5
  disable-model-invocation: true
6
6
  suggestion:
7
7
  eligible: true
8
- trigger_description: "show chat-history status, resume from log, clear the chat-history file, append a checkpoint entry"
9
- trigger_context: "user wants to inspect, restore, wipe, or manually flush .agent-chat-history"
8
+ trigger_description: "show chat-history status, inspect agents/.agent-chat-history log, import a prior session into the current chat, mine a prior session for project-improving learnings"
9
+ trigger_context: "user wants to inspect the persistent agents/.agent-chat-history log, pull a prior session in verbatim, or extract learnings from a prior session"
10
10
  ---
11
11
 
12
12
  <!-- cloud_safe: noop -->
13
13
 
14
14
  # /chat-history
15
15
 
16
- Top-level orchestrator for the `/chat-history` family. Replaces 4
17
- standalone commands with a single entry point + sub-command dispatch.
16
+ Top-level orchestrator for the `/chat-history` family. After the
17
+ hook-only reduction (`road-to-chat-history-hook-only`) writes and
18
+ overflow handling are driven entirely by platform hooks +
19
+ `scripts/chat_history.py` internals; the surfaced sub-commands are
20
+ read-only on the log itself. Sessions coexist in one log file —
21
+ each entry self-tags via the `s` field — so there is no ownership
22
+ layer to recover from.
18
23
 
19
24
  ## Sub-commands
20
25
 
21
26
  | Sub-command | Routes to | Purpose |
22
27
  |---|---|---|
23
- | `/chat-history show` | `commands/chat-history/show.md` | Inspect the log — size, entries, fingerprint, last entries |
24
- | `/chat-history resume` | `commands/chat-history/resume.md` | Adopt and load the persistent log into the current conversation |
25
- | `/chat-history clear` | `commands/chat-history/clear.md` | Wipe the log (with optional archival backup) |
26
- | `/chat-history checkpoint` | `commands/chat-history/checkpoint.md` | Append a phase-boundary entry on CHECKPOINT-class platforms |
27
-
28
- Sub-command names match the locked contract in
29
- [`docs/contracts/command-clusters.md`](../../docs/contracts/command-clusters.md).
28
+ | `/chat-history show` | `commands/chat-history/show.md` | Inspect the log — size, entries, header, last entries |
29
+ | `/chat-history import` | `commands/chat-history/import.md` | List prior sessions, pick one, render its entries verbatim selective cross-session import |
30
+ | `/chat-history learn` | `commands/chat-history/learn.md` | List prior sessions, pick one, mine it for project-improving learnings via `learning-to-rule-or-skill` |
30
31
 
31
32
  ## Dispatch
32
33
 
33
34
  1. Parse the user's argument: `/chat-history <sub-command> [args]`.
34
35
  2. Look up the sub-command in the table above.
35
- 3. Load the body of the routed file and follow its `## Instructions`
36
- (or `## Steps`) section verbatim with the remaining args.
37
- 4. If the sub-command is unknown or missing, print the table above and
38
- ask:
39
-
40
- > 1. show — inspect status, size, last entries
41
- > 2. resume — adopt the log into the conversation
42
- > 3. clear — wipe the file
43
- > 4. checkpoint — append a phase-boundary entry
36
+ 3. Load the body of the routed file and follow its `## Steps`
37
+ section verbatim with the remaining args.
38
+ 4. If the sub-command is unknown or missing (including the bare
39
+ `/chat-history` invocation), route to `show` — the safe,
40
+ current-session inspector default. `import` and `learn` are
41
+ opt-in only.
44
42
 
45
43
  ## Rules
46
44
 
47
- - **Do NOT commit, push, or open a PR** unless the sub-command
48
- explicitly authorizes it.
45
+ - **Do NOT commit, push, or open a PR** `show` and `import` are
46
+ read-only; `learn` writes proposal drafts under
47
+ `agents/proposals/` only and does not commit them.
49
48
  - **Do NOT chain sub-commands.** One `/chat-history <sub>` per turn.
50
- - If the user invokes `/chat-history` with no argument, **show the
51
- menu** do not guess which sub-command they meant.
49
+ - **`import` and `learn` cross the session boundary** — only run
50
+ them when the user explicitly asked for cross-session reading.
51
+ The default read path (filtered to current session) stays in
52
+ effect for every other tool.
@@ -28,8 +28,7 @@ The user invoked `/council default` on exactly one input mode:
28
28
  - `files:<path>,<path>` — a comma-separated file list
29
29
 
30
30
  Optional invocation flag: `mode:api|manual` overrides the per-member
31
- and global mode for this call only (see Step 2.5). `mode:playwright`
32
- is reserved for Phase 2c — refuse politely if invoked.
31
+ and global mode for this call only (see Step 2.5).
33
32
 
34
33
  Optional **rounds**: `rounds:N` (1-3) enables multi-round debate. Round
35
34
  1 sees the artefact alone. Round 2+ sees the artefact plus anonymised
@@ -71,7 +70,7 @@ Read `.agent-settings.yml` → `ai_council`:
71
70
  to env vars. Ever.
72
71
 
73
72
  Load the price table via `scripts.ai_council.pricing.load_prices()`
74
- (auto-bootstraps `.agent-prices.md` from defaults if missing). Run
73
+ (auto-bootstraps `agents/.agent-prices.md` from defaults if missing). Run
75
74
  `pricing.is_stale(table)` and, if stale, surface the staleness gate
76
75
  from the `ai-council` skill (§ Stale price-table gate) before
77
76
  continuing.
@@ -81,15 +80,13 @@ continuing.
81
80
  For each enabled member, resolve its mode via
82
81
  `scripts.ai_council.modes.resolve_mode(name, invocation_mode,
83
82
  member_settings, global_mode)`. Precedence: invocation flag >
84
- per-member setting > global setting > default (`api`).
83
+ per-member setting > global setting > default (`manual`).
85
84
 
86
85
  Construct each member from the resolved mode:
87
86
 
88
87
  - `api` → `AnthropicClient` / `OpenAIClient` (billable, cost-gated).
89
88
  - `manual` → `ManualClient` from `scripts.ai_council.clients`
90
89
  (`billable=False`, no API key, no SDK call).
91
- - `playwright` → reserved for Phase 2c. If a settings/invocation
92
- resolves to it, refuse with a one-line note.
93
90
 
94
91
  ### 3. Cost confirmation — ALWAYS ASK for billable members
95
92
 
@@ -203,7 +200,7 @@ council can act on the project directly.
203
200
  - **Stale price table, refresher fails (offline)** → state the
204
201
  failure, re-offer "continue with stale table / cancel", do not
205
202
  proceed silently.
206
- - **`.agent-prices.md` corrupt (missing frontmatter or columns)** →
203
+ - **`agents/.agent-prices.md` corrupt (missing frontmatter or columns)** →
207
204
  surface the parse error, suggest deleting the file to bootstrap
208
205
  fresh from defaults; never silently fall back.
209
206
  - **All members error (CLI exit 1)** → render the errors via
@@ -106,19 +106,39 @@ Once the user approves the content from step 2:
106
106
 
107
107
  ### 4. After creation
108
108
 
109
- - Show the PR URL.
110
- - If a Jira ticket was linked, ask:
111
- ```
112
- > Transition Jira ticket {TICKET-ID} to "In Review"?
113
- >
114
- > 1. Yes — update status
115
- > 2. Noleave as-is
116
- ```
109
+ #### 4a. Strip attribution footers (mandatory)
110
+
111
+ `github-api` may server-side-append attribution after a clean send.
112
+ Per [`no-attribution-footers`](../rules/no-attribution-footers.md),
113
+ re-check the body after creation **and after every body PATCH**:
114
+
115
+ 1. `GET /repos/{owner}/{repo}/pulls/{number}` re-fetch body.
116
+ 2. Search (case-insensitive) for: `Generated with [Augment Code]`,
117
+ `🤖 Generated with`, `Pull Request opened by [Augment Code]`,
118
+ `Co-authored by Augment Code`, unsolicited `augmentcode.com` link.
119
+ 3. If any present, strip with surrounding `---` and trailing
120
+ whitespace, then `PATCH /pulls/{number}` with cleaned body.
121
+ 4. Re-fetch to verify. If the pattern reappears, repeat once; if
122
+ still present, surface to user and stop (no strip/PATCH loop).
123
+ 5. Note in the reply how many footers were removed (or "clean").
124
+
125
+ #### 4b. Show the PR URL
126
+
127
+ #### 4c. Jira transition
128
+
129
+ If a Jira ticket was linked, ask:
130
+ ```
131
+ > Transition Jira ticket {TICKET-ID} to "In Review"?
132
+ >
133
+ > 1. Yes — update status
134
+ > 2. No — leave as-is
135
+ ```
117
136
 
118
137
  ### Rules
119
138
 
120
139
  - **Always use the PR template** from `.github/pull_request_template.md` — read it, fill its sections.
121
140
  - **Always show the PR content before creating it** — never create blindly.
122
141
  - **Push the branch first** if it hasn't been pushed (with user permission).
142
+ - **Never add attribution footers** — see [`no-attribution-footers`](../rules/no-attribution-footers.md). Strip-pass in 4a defends against tool-injected footers.
123
143
  - Only create the PR — never merge it.
124
144
  - Only commit or push with explicit user permission.
@@ -11,7 +11,7 @@ suggestion:
11
11
 
12
12
  Ensures the consumer project's `.gitignore` contains every entry the
13
13
  package expects to be ignored (symlinked `.augment/` subdirectories,
14
- `/agent-config` CLI wrapper, `.agent-settings*`, `.agent-chat-history*`).
14
+ `/agent-config` CLI wrapper, `.agent-settings*`, `agents/.agent-chat-history*`).
15
15
  Canonical list lives in `config/gitignore-block.txt`; the same file
16
16
  drives the installer, so the two cannot drift.
17
17