@event4u/agent-config 1.17.0 → 1.19.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.
- package/.agent-src/commands/council/default.md +74 -76
- package/.agent-src/commands/feature/roadmap.md +22 -0
- package/.agent-src/commands/roadmap/create.md +38 -6
- package/.agent-src/commands/roadmap/execute.md +36 -9
- package/.agent-src/rules/agent-authority.md +1 -0
- package/.agent-src/rules/agent-docs.md +1 -0
- package/.agent-src/rules/analysis-skill-routing.md +1 -0
- package/.agent-src/rules/architecture.md +1 -0
- package/.agent-src/rules/artifact-drafting-protocol.md +1 -0
- package/.agent-src/rules/artifact-engagement-recording.md +1 -0
- package/.agent-src/rules/ask-when-uncertain.md +1 -0
- package/.agent-src/rules/augment-portability.md +1 -0
- package/.agent-src/rules/augment-source-of-truth.md +1 -0
- package/.agent-src/rules/autonomous-execution.md +1 -0
- package/.agent-src/rules/capture-learnings.md +1 -0
- package/.agent-src/rules/chat-history-cadence.md +34 -0
- package/.agent-src/rules/chat-history-ownership.md +1 -0
- package/.agent-src/rules/chat-history-visibility.md +1 -0
- package/.agent-src/rules/cli-output-handling.md +2 -2
- package/.agent-src/rules/command-suggestion-policy.md +1 -0
- package/.agent-src/rules/commit-conventions.md +1 -0
- package/.agent-src/rules/commit-policy.md +1 -0
- package/.agent-src/rules/context-hygiene.md +28 -0
- package/.agent-src/rules/direct-answers.md +18 -26
- package/.agent-src/rules/docker-commands.md +1 -0
- package/.agent-src/rules/docs-sync.md +1 -0
- package/.agent-src/rules/downstream-changes.md +1 -0
- package/.agent-src/rules/e2e-testing.md +1 -0
- package/.agent-src/rules/guidelines.md +1 -0
- package/.agent-src/rules/improve-before-implement.md +1 -0
- package/.agent-src/rules/language-and-tone.md +1 -0
- package/.agent-src/rules/laravel-translations.md +1 -0
- package/.agent-src/rules/markdown-safe-codeblocks.md +1 -0
- package/.agent-src/rules/minimal-safe-diff.md +1 -0
- package/.agent-src/rules/missing-tool-handling.md +1 -0
- package/.agent-src/rules/model-recommendation.md +1 -0
- package/.agent-src/rules/no-cheap-questions.md +15 -21
- package/.agent-src/rules/no-roadmap-references.md +1 -0
- package/.agent-src/rules/non-destructive-by-default.md +1 -0
- package/.agent-src/rules/onboarding-gate.md +33 -0
- package/.agent-src/rules/package-ci-checks.md +1 -0
- package/.agent-src/rules/php-coding.md +1 -0
- package/.agent-src/rules/preservation-guard.md +1 -0
- package/.agent-src/rules/review-routing-awareness.md +1 -0
- package/.agent-src/rules/reviewer-awareness.md +1 -0
- package/.agent-src/rules/roadmap-progress-sync.md +49 -0
- package/.agent-src/rules/role-mode-adherence.md +2 -2
- package/.agent-src/rules/rule-type-governance.md +29 -0
- package/.agent-src/rules/runtime-safety.md +1 -0
- package/.agent-src/rules/scope-control.md +1 -0
- package/.agent-src/rules/security-sensitive-stop.md +1 -0
- package/.agent-src/rules/size-enforcement.md +1 -0
- package/.agent-src/rules/skill-improvement-trigger.md +1 -0
- package/.agent-src/rules/skill-quality.md +1 -0
- package/.agent-src/rules/slash-command-routing-policy.md +39 -0
- package/.agent-src/rules/think-before-action.md +1 -0
- package/.agent-src/rules/token-efficiency.md +1 -0
- package/.agent-src/rules/tool-safety.md +1 -0
- package/.agent-src/rules/ui-audit-gate.md +1 -0
- package/.agent-src/rules/upstream-proposal.md +1 -0
- package/.agent-src/rules/user-interaction.md +1 -0
- package/.agent-src/rules/verify-before-complete.md +1 -0
- package/.agent-src/skills/roadmap-management/SKILL.md +29 -4
- package/.agent-src/skills/verify-completion-evidence/SKILL.md +8 -1
- package/.agent-src/templates/agent-settings.md +16 -0
- package/.agent-src/templates/roadmaps.md +12 -3
- package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +9 -0
- package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +4 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +4 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.py +163 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +111 -0
- package/.agent-src/templates/scripts/work_engine/hooks/settings.py +36 -0
- package/.agent-src/templates/scripts/work_engine/scoring/decision_trace.py +141 -0
- package/.agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +125 -0
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +97 -0
- package/README.md +20 -20
- package/config/agent-settings.template.yml +23 -0
- package/docs/architecture.md +1 -1
- package/docs/catalog.md +5 -2
- package/docs/contracts/adr-settings-sync-engine.md +127 -0
- package/docs/contracts/decision-trace-v1.md +146 -0
- package/docs/contracts/file-ownership-matrix.json +7 -0
- package/docs/contracts/hook-architecture-v1.md +213 -0
- package/docs/contracts/load-context-budget-model.md +80 -0
- package/docs/contracts/load-context-schema.md +20 -0
- package/docs/contracts/memory-visibility-v1.md +138 -0
- package/docs/contracts/one-off-script-lifecycle.md +109 -0
- package/docs/contracts/roadmap-complexity-standard.md +137 -0
- package/docs/contracts/rule-interactions.yml +22 -0
- package/docs/customization.md +1 -0
- package/docs/development.md +4 -1
- package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +134 -0
- package/docs/guidelines/agent-infra/direct-answers-demos.md +145 -0
- package/docs/guidelines/agent-infra/layered-settings.md +32 -13
- package/docs/guidelines/agent-infra/verify-before-complete-demos.md +128 -0
- package/package.json +1 -1
- package/scripts/agent-config +64 -0
- package/scripts/ai_council/bundler.py +3 -3
- package/scripts/ai_council/clients.py +24 -8
- package/scripts/ai_council/one_off_archive/2026-05/README.md +67 -0
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_budget_v2_audit.py +206 -0
- package/scripts/ai_council/{_one_off_roundtrip.py → one_off_archive/2026-05/_one_off_roundtrip.py} +13 -8
- package/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +180 -0
- package/scripts/ai_council/session.py +92 -0
- package/scripts/build_rule_trigger_matrix.py +360 -0
- package/scripts/capture_showcase_session.py +361 -0
- package/scripts/chat_history.py +11 -1
- package/scripts/check_always_budget.py +46 -2
- package/scripts/check_one_off_location.py +81 -0
- package/scripts/check_references.py +6 -0
- package/scripts/compress.py +5 -2
- package/scripts/context_hygiene_hook.py +181 -0
- package/scripts/council_cli.py +357 -0
- package/scripts/hook_manifest.yaml +184 -0
- package/scripts/hooks/__init__.py +1 -0
- package/scripts/hooks/augment-context-hygiene.sh +55 -0
- package/scripts/hooks/augment-dispatcher.sh +72 -0
- package/scripts/hooks/augment-onboarding-gate.sh +55 -0
- package/scripts/hooks/cline-dispatcher.sh +86 -0
- package/scripts/hooks/cursor-dispatcher.sh +76 -0
- package/scripts/hooks/dispatch_hook.py +348 -0
- package/scripts/hooks/envelope.py +98 -0
- package/scripts/hooks/gemini-dispatcher.sh +117 -0
- package/scripts/hooks/state_io.py +122 -0
- package/scripts/hooks/windsurf-dispatcher.sh +123 -0
- package/scripts/hooks_status.py +146 -0
- package/scripts/install.py +728 -51
- package/scripts/install.sh +1 -1
- package/scripts/lint_examples.py +98 -0
- package/scripts/lint_hook_manifest.py +216 -0
- package/scripts/lint_one_off_age.py +184 -0
- package/scripts/lint_roadmap_complexity.py +127 -0
- package/scripts/lint_rule_tiers.py +78 -0
- package/scripts/lint_showcase_sessions.py +148 -0
- package/scripts/minimal_safe_diff_hook.py +245 -0
- package/scripts/onboarding_gate_hook.py +142 -0
- package/scripts/readme_linter.py +12 -3
- package/scripts/roadmap_progress_hook.py +5 -0
- package/scripts/schemas/rule.schema.json +5 -0
- package/scripts/sync_agent_settings.py +32 -129
- package/scripts/sync_yaml_rt.py +734 -0
- package/scripts/verify_before_complete_hook.py +216 -0
- /package/scripts/ai_council/{_one_off_2a4_acceptance.py → one_off_archive/2026-05/_one_off_2a4_acceptance.py} +0 -0
- /package/scripts/ai_council/{_one_off_context_layer_v1_estimate.py → one_off_archive/2026-05/_one_off_context_layer_v1_estimate.py} +0 -0
- /package/scripts/ai_council/{_one_off_context_layer_v1_review.py → one_off_archive/2026-05/_one_off_context_layer_v1_review.py} +0 -0
- /package/scripts/ai_council/{_one_off_followups_review.py → one_off_archive/2026-05/_one_off_followups_review.py} +0 -0
- /package/scripts/ai_council/{_one_off_nondestructive_inline_audit.py → one_off_archive/2026-05/_one_off_nondestructive_inline_audit.py} +0 -0
- /package/scripts/{_one_off_phase4_dispatch_latency.py → ai_council/one_off_archive/2026-05/_one_off_phase4_dispatch_latency.py} +0 -0
- /package/scripts/{_one_off_phase6_trigger_jaccard.py → ai_council/one_off_archive/2026-05/_one_off_phase6_trigger_jaccard.py} +0 -0
- /package/scripts/ai_council/{_one_off_phase_2a_budget_rebalance.py → one_off_archive/2026-05/_one_off_phase_2a_budget_rebalance.py} +0 -0
- /package/scripts/ai_council/{_one_off_phase_2a_post_revert.py → one_off_archive/2026-05/_one_off_phase_2a_post_revert.py} +0 -0
- /package/scripts/ai_council/{_one_off_rebalancing_audit.py → one_off_archive/2026-05/_one_off_rebalancing_audit.py} +0 -0
- /package/scripts/ai_council/{_one_off_rule_hardening_v1.py → one_off_archive/2026-05/_one_off_rule_hardening_v1.py} +0 -0
- /package/scripts/ai_council/{_one_off_structural_open_questions.py → one_off_archive/2026-05/_one_off_structural_open_questions.py} +0 -0
- /package/scripts/ai_council/{_one_off_structural_optimization.py → one_off_archive/2026-05/_one_off_structural_optimization.py} +0 -0
- /package/scripts/ai_council/{_one_off_structural_v3_gaps.py → one_off_archive/2026-05/_one_off_structural_v3_gaps.py} +0 -0
- /package/scripts/ai_council/{_one_off_structural_v3_review.py → one_off_archive/2026-05/_one_off_structural_v3_review.py} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Hook manifest — single source of truth for which concerns fire on which
|
|
2
|
+
# (platform, event) tuples. Consumed by:
|
|
3
|
+
# - scripts/hooks/dispatch_hook.py (runtime resolver)
|
|
4
|
+
# - scripts/lint_hook_manifest.py (CI gate; Phase 7.10)
|
|
5
|
+
# - scripts/install.py (per-platform config writer)
|
|
6
|
+
#
|
|
7
|
+
# Schema and event vocabulary: docs/contracts/hook-architecture-v1.md.
|
|
8
|
+
# Per-platform event-name mapping: agents/contexts/chat-history-platform-hooks.md.
|
|
9
|
+
#
|
|
10
|
+
# When you add or remove a concern, also update:
|
|
11
|
+
# - scripts/agent-config (CLI subcommand wiring, if exposed)
|
|
12
|
+
# - the source rule's "Copilot fallback" section (Phase 7.9)
|
|
13
|
+
# - the relevant snapshot tests under tests/hooks/ (Phase 7.11)
|
|
14
|
+
schema_version: 1
|
|
15
|
+
|
|
16
|
+
concerns:
|
|
17
|
+
chat-history:
|
|
18
|
+
script: scripts/chat_history.py
|
|
19
|
+
args: [hook-dispatch]
|
|
20
|
+
fail_closed: false
|
|
21
|
+
roadmap-progress:
|
|
22
|
+
script: scripts/roadmap_progress_hook.py
|
|
23
|
+
args: []
|
|
24
|
+
fail_closed: false
|
|
25
|
+
onboarding-gate:
|
|
26
|
+
script: scripts/onboarding_gate_hook.py
|
|
27
|
+
args: []
|
|
28
|
+
fail_closed: false
|
|
29
|
+
context-hygiene:
|
|
30
|
+
script: scripts/context_hygiene_hook.py
|
|
31
|
+
args: []
|
|
32
|
+
fail_closed: false
|
|
33
|
+
# Phase 5 — Tier-1 hook for the verify-before-complete rule. Records
|
|
34
|
+
# observable evidence of verification commands (tests, quality tools,
|
|
35
|
+
# builds) into agents/state/verify-before-complete.json. The rule body
|
|
36
|
+
# cites that file as the source of truth for "verified this turn?".
|
|
37
|
+
verify-before-complete:
|
|
38
|
+
script: scripts/verify_before_complete_hook.py
|
|
39
|
+
args: []
|
|
40
|
+
fail_closed: false
|
|
41
|
+
# Phase 5 — Tier-1 hook for the minimal-safe-diff rule. Counts unique
|
|
42
|
+
# files touched per turn into agents/state/minimal-safe-diff.json and
|
|
43
|
+
# flips warning=true past hooks.minimal_safe_diff.threshold.
|
|
44
|
+
minimal-safe-diff:
|
|
45
|
+
script: scripts/minimal_safe_diff_hook.py
|
|
46
|
+
args: []
|
|
47
|
+
fail_closed: false
|
|
48
|
+
|
|
49
|
+
platforms:
|
|
50
|
+
augment:
|
|
51
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete, minimal-safe-diff]
|
|
52
|
+
session_end: [chat-history]
|
|
53
|
+
stop: [chat-history, verify-before-complete]
|
|
54
|
+
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff]
|
|
55
|
+
|
|
56
|
+
claude:
|
|
57
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete, minimal-safe-diff]
|
|
58
|
+
session_end: [chat-history]
|
|
59
|
+
stop: [chat-history, verify-before-complete]
|
|
60
|
+
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
61
|
+
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff]
|
|
62
|
+
|
|
63
|
+
# Phase 7.5 — Cursor. `.cursor/hooks.json` (project) is read by the
|
|
64
|
+
# IDE and CLI; `~/.cursor/hooks.json` (user) is opt-in via
|
|
65
|
+
# `install.py --cursor-user-hooks` and uses scripts/hooks/cursor-dispatcher.sh
|
|
66
|
+
# to route into the active workspace. UserPromptSubmit maps to
|
|
67
|
+
# `beforeSubmitPrompt` (Cursor third-party-hooks table). Stop is
|
|
68
|
+
# IDE-only — CLI-only users fall back to /checkpoint per
|
|
69
|
+
# agents/contexts/chat-history-platform-hooks.md.
|
|
70
|
+
cursor:
|
|
71
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete, minimal-safe-diff]
|
|
72
|
+
session_end: [chat-history]
|
|
73
|
+
stop: [chat-history, verify-before-complete]
|
|
74
|
+
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
75
|
+
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff]
|
|
76
|
+
|
|
77
|
+
# Phase 7.6 — Cline. Hooks live under `.clinerules/hooks/<HookName>`
|
|
78
|
+
# (project, no file extension, must be executable per Cline docs) or
|
|
79
|
+
# `~/Documents/Cline/Hooks/<HookName>` (global). Each script reads a
|
|
80
|
+
# JSON payload from stdin (`taskId`, `hookName`, `workspaceRoots`,
|
|
81
|
+
# `model`, plus a hook-specific field). Cline emits two distinct
|
|
82
|
+
# task-start events — TaskStart (new) and TaskResume (continue) —
|
|
83
|
+
# both map to session_start. TaskCancel maps to stop because the
|
|
84
|
+
# session is interrupted with partial state (mirrors Augment Stop).
|
|
85
|
+
cline:
|
|
86
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete, minimal-safe-diff]
|
|
87
|
+
session_end: [chat-history]
|
|
88
|
+
stop: [chat-history, verify-before-complete]
|
|
89
|
+
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
90
|
+
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff]
|
|
91
|
+
|
|
92
|
+
# Phase 7.7 — Windsurf (Cascade). Hooks live at `.windsurf/hooks.json`
|
|
93
|
+
# (project) or `~/.codeium/windsurf/hooks.json` (user). Cascade has
|
|
94
|
+
# no generic post-tool-use surface — roadmap-progress and
|
|
95
|
+
# context-hygiene therefore have no Windsurf binding (documented
|
|
96
|
+
# platform limitation). chat-history wires through the per-turn
|
|
97
|
+
# cycle: pre_user_prompt for the turn-check, post_cascade_response
|
|
98
|
+
# for the per-turn append, and post_setup_worktree for first-run
|
|
99
|
+
# init (rare, fires only on worktree creation; advisory not
|
|
100
|
+
# blocking — Windsurf docs).
|
|
101
|
+
# Windsurf — verify-before-complete tracks lifecycle only (no post_tool_use
|
|
102
|
+
# surface to record verification commands; documented limitation).
|
|
103
|
+
# minimal-safe-diff is omitted entirely on Windsurf for the same reason.
|
|
104
|
+
windsurf:
|
|
105
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete]
|
|
106
|
+
stop: [chat-history, verify-before-complete]
|
|
107
|
+
user_prompt_submit: [chat-history, verify-before-complete]
|
|
108
|
+
|
|
109
|
+
# Phase 7.8 — Gemini CLI. Hooks live at `.gemini/settings.json`
|
|
110
|
+
# (project) or `~/.gemini/settings.json` (user). Per Gemini docs
|
|
111
|
+
# (geminicli.com/docs/hooks/reference/), each event maps to an
|
|
112
|
+
# array of hook groups; each group has a `matcher` (regex for
|
|
113
|
+
# tool events, exact string for lifecycle) and a `hooks` array of
|
|
114
|
+
# `{type: "command", command: "..."}`. SessionStart/SessionEnd are
|
|
115
|
+
# advisory (cannot block); BeforeAgent fires after the user
|
|
116
|
+
# submits a prompt and before agent planning, so it carries the
|
|
117
|
+
# turn-check semantics. AfterAgent fires when the agent loop ends
|
|
118
|
+
# — this is our `stop` slot.
|
|
119
|
+
gemini:
|
|
120
|
+
session_start: [chat-history, onboarding-gate, verify-before-complete, minimal-safe-diff]
|
|
121
|
+
session_end: [chat-history]
|
|
122
|
+
stop: [chat-history, verify-before-complete]
|
|
123
|
+
user_prompt_submit: [chat-history, verify-before-complete, minimal-safe-diff]
|
|
124
|
+
post_tool_use: [chat-history, roadmap-progress, context-hygiene, verify-before-complete, minimal-safe-diff]
|
|
125
|
+
|
|
126
|
+
# Phase 7.9 — Copilot has no hook surface. Concerns route through
|
|
127
|
+
# rule-only fallback; the dispatcher silently no-ops on --platform copilot.
|
|
128
|
+
copilot:
|
|
129
|
+
fallback_only: true
|
|
130
|
+
|
|
131
|
+
# Native-event → agent-config-event translation table. Used by per-platform
|
|
132
|
+
# trampolines when the platform speaks a different vocabulary. Trampolines
|
|
133
|
+
# pass --native-event for traceability; the dispatcher does NOT branch on it.
|
|
134
|
+
native_event_aliases:
|
|
135
|
+
augment:
|
|
136
|
+
SessionStart: session_start
|
|
137
|
+
SessionEnd: session_end
|
|
138
|
+
Stop: stop
|
|
139
|
+
PostToolUse: post_tool_use
|
|
140
|
+
PreToolUse: pre_tool_use
|
|
141
|
+
claude:
|
|
142
|
+
SessionStart: session_start
|
|
143
|
+
SessionEnd: session_end
|
|
144
|
+
Stop: stop
|
|
145
|
+
UserPromptSubmit: user_prompt_submit
|
|
146
|
+
PostToolUse: post_tool_use
|
|
147
|
+
PreToolUse: pre_tool_use
|
|
148
|
+
PreCompact: pre_compact
|
|
149
|
+
cursor:
|
|
150
|
+
sessionStart: session_start
|
|
151
|
+
sessionEnd: session_end
|
|
152
|
+
stop: stop
|
|
153
|
+
beforeSubmitPrompt: user_prompt_submit
|
|
154
|
+
postToolUse: post_tool_use
|
|
155
|
+
preToolUse: pre_tool_use
|
|
156
|
+
preCompact: pre_compact
|
|
157
|
+
cline:
|
|
158
|
+
TaskStart: session_start
|
|
159
|
+
TaskResume: session_start
|
|
160
|
+
TaskComplete: session_end
|
|
161
|
+
TaskCancel: stop
|
|
162
|
+
UserPromptSubmit: user_prompt_submit
|
|
163
|
+
PostToolUse: post_tool_use
|
|
164
|
+
PreToolUse: pre_tool_use
|
|
165
|
+
PreCompact: pre_compact
|
|
166
|
+
# Windsurf (Cascade) — snake_case event names per
|
|
167
|
+
# docs.windsurf.com/windsurf/cascade/hooks. post_cascade_response is
|
|
168
|
+
# async (off the critical path) so the per-turn append safely lands
|
|
169
|
+
# in the `stop` slot rather than `session_end`.
|
|
170
|
+
windsurf:
|
|
171
|
+
pre_user_prompt: user_prompt_submit
|
|
172
|
+
post_cascade_response: stop
|
|
173
|
+
post_setup_worktree: session_start
|
|
174
|
+
# Gemini CLI — PascalCase event names per geminicli.com/docs/hooks/.
|
|
175
|
+
# BeforeAgent fires after the user submits a prompt and before
|
|
176
|
+
# planning (carries the turn-check / append-on-prompt semantics).
|
|
177
|
+
# AfterAgent fires when the agent loop ends — our `stop` slot.
|
|
178
|
+
gemini:
|
|
179
|
+
SessionStart: session_start
|
|
180
|
+
SessionEnd: session_end
|
|
181
|
+
BeforeAgent: user_prompt_submit
|
|
182
|
+
AfterAgent: stop
|
|
183
|
+
BeforeTool: pre_tool_use
|
|
184
|
+
AfterTool: post_tool_use
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Augment Code lifecycle-hook trampoline for context-hygiene.
|
|
3
|
+
#
|
|
4
|
+
# Augment requires hook scripts to use the .sh extension and live at
|
|
5
|
+
# either a system path (/etc/augment/...) or user scope
|
|
6
|
+
# (~/.augment/...). This trampoline lives at user scope and dispatches
|
|
7
|
+
# every PostToolUse event to whichever workspace fired it, so a single
|
|
8
|
+
# install covers every project that has ./agent-config available.
|
|
9
|
+
#
|
|
10
|
+
# Behaviour:
|
|
11
|
+
# - Read the JSON event from stdin into a buffer.
|
|
12
|
+
# - Extract workspace_roots[0]; bail silently when missing.
|
|
13
|
+
# - cd into that workspace; bail silently when it is not a directory
|
|
14
|
+
# or does not contain ./agent-config.
|
|
15
|
+
# - Re-pipe the original JSON into
|
|
16
|
+
# ./agent-config context-hygiene:hook --platform augment
|
|
17
|
+
# so context_hygiene_hook.py can update the per-turn tracker.
|
|
18
|
+
# - Always exit 0 — PostToolUse hooks must never block.
|
|
19
|
+
|
|
20
|
+
set -u
|
|
21
|
+
|
|
22
|
+
EVENT_DATA="$(cat)"
|
|
23
|
+
|
|
24
|
+
WORKSPACE=""
|
|
25
|
+
if command -v jq >/dev/null 2>&1; then
|
|
26
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" \
|
|
27
|
+
| jq -r '.workspace_roots[0] // empty' 2>/dev/null)"
|
|
28
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
29
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" | python3 -c '
|
|
30
|
+
import json, sys
|
|
31
|
+
try:
|
|
32
|
+
data = json.load(sys.stdin)
|
|
33
|
+
except Exception:
|
|
34
|
+
sys.exit(0)
|
|
35
|
+
roots = data.get("workspace_roots") or []
|
|
36
|
+
if roots:
|
|
37
|
+
print(roots[0])
|
|
38
|
+
' 2>/dev/null)"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]; then
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
cd "$WORKSPACE" 2>/dev/null || exit 0
|
|
46
|
+
|
|
47
|
+
if [ ! -x ./agent-config ]; then
|
|
48
|
+
exit 0
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
printf '%s' "$EVENT_DATA" \
|
|
52
|
+
| ./agent-config context-hygiene:hook --platform augment \
|
|
53
|
+
>/dev/null 2>&1 || true
|
|
54
|
+
|
|
55
|
+
exit 0
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Augment Code universal hook trampoline (Phase 7.3, hook-architecture-v1.md).
|
|
3
|
+
#
|
|
4
|
+
# Replaces the four per-concern trampolines (augment-chat-history.sh,
|
|
5
|
+
# augment-roadmap-progress.sh, augment-onboarding-gate.sh,
|
|
6
|
+
# augment-context-hygiene.sh). One script, dispatched per (platform, event)
|
|
7
|
+
# tuple via scripts/hooks/dispatch_hook.py reading scripts/hook_manifest.yaml.
|
|
8
|
+
#
|
|
9
|
+
# Augment requires hook scripts to use the .sh extension and live at user
|
|
10
|
+
# scope (~/.augment/hooks/) — same constraint as the legacy trampolines.
|
|
11
|
+
#
|
|
12
|
+
# Behaviour:
|
|
13
|
+
# - Read the JSON event from stdin into a buffer.
|
|
14
|
+
# - Extract workspace_roots[0]; bail silently when missing.
|
|
15
|
+
# - cd into that workspace; bail silently when it is not a directory
|
|
16
|
+
# or does not contain ./agent-config.
|
|
17
|
+
# - Re-pipe the original JSON into
|
|
18
|
+
# ./agent-config dispatch:hook --platform augment \
|
|
19
|
+
# --event $1 --native-event $2
|
|
20
|
+
# - Always exit 0 — Augment hooks must never block the agent loop
|
|
21
|
+
# (chat-history / roadmap-progress / context-hygiene are observe-only;
|
|
22
|
+
# onboarding-gate writes state but does not deny SessionStart).
|
|
23
|
+
|
|
24
|
+
set -u
|
|
25
|
+
|
|
26
|
+
# Args from the platform's settings.json hook entry:
|
|
27
|
+
# $1 = agent-config event name (session_start, post_tool_use, …)
|
|
28
|
+
# $2 = Augment-native event name (SessionStart, PostToolUse, …)
|
|
29
|
+
EVENT="${1-}"
|
|
30
|
+
NATIVE_EVENT="${2-}"
|
|
31
|
+
|
|
32
|
+
if [ -z "$EVENT" ]; then
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
EVENT_DATA="$(cat)"
|
|
37
|
+
|
|
38
|
+
WORKSPACE=""
|
|
39
|
+
if command -v jq >/dev/null 2>&1; then
|
|
40
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" \
|
|
41
|
+
| jq -r '.workspace_roots[0] // empty' 2>/dev/null)"
|
|
42
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
43
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" | python3 -c '
|
|
44
|
+
import json, sys
|
|
45
|
+
try:
|
|
46
|
+
data = json.load(sys.stdin)
|
|
47
|
+
except Exception:
|
|
48
|
+
sys.exit(0)
|
|
49
|
+
roots = data.get("workspace_roots") or []
|
|
50
|
+
if roots:
|
|
51
|
+
print(roots[0])
|
|
52
|
+
' 2>/dev/null)"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]; then
|
|
56
|
+
exit 0
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
cd "$WORKSPACE" 2>/dev/null || exit 0
|
|
60
|
+
|
|
61
|
+
if [ ! -x ./agent-config ]; then
|
|
62
|
+
exit 0
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
printf '%s' "$EVENT_DATA" \
|
|
66
|
+
| ./agent-config dispatch:hook \
|
|
67
|
+
--platform augment \
|
|
68
|
+
--event "$EVENT" \
|
|
69
|
+
--native-event "$NATIVE_EVENT" \
|
|
70
|
+
>/dev/null 2>&1 || true
|
|
71
|
+
|
|
72
|
+
exit 0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Augment Code lifecycle-hook trampoline for onboarding-gate.
|
|
3
|
+
#
|
|
4
|
+
# Augment requires hook scripts to use the .sh extension and live at
|
|
5
|
+
# either a system path (/etc/augment/...) or user scope
|
|
6
|
+
# (~/.augment/...). This trampoline lives at user scope and dispatches
|
|
7
|
+
# every event to whichever workspace fired it, so a single install
|
|
8
|
+
# covers every project that has ./agent-config available.
|
|
9
|
+
#
|
|
10
|
+
# Behaviour:
|
|
11
|
+
# - Read the JSON event from stdin into a buffer.
|
|
12
|
+
# - Extract workspace_roots[0]; bail silently when missing.
|
|
13
|
+
# - cd into that workspace; bail silently when it is not a directory
|
|
14
|
+
# or does not contain ./agent-config.
|
|
15
|
+
# - Re-pipe the original JSON into
|
|
16
|
+
# ./agent-config onboarding-gate:hook --platform augment
|
|
17
|
+
# so onboarding_gate_hook.py can refresh the state file.
|
|
18
|
+
# - Always exit 0 — onboarding-gate must never block the agent loop.
|
|
19
|
+
|
|
20
|
+
set -u
|
|
21
|
+
|
|
22
|
+
EVENT_DATA="$(cat)"
|
|
23
|
+
|
|
24
|
+
WORKSPACE=""
|
|
25
|
+
if command -v jq >/dev/null 2>&1; then
|
|
26
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" \
|
|
27
|
+
| jq -r '.workspace_roots[0] // empty' 2>/dev/null)"
|
|
28
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
29
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" | python3 -c '
|
|
30
|
+
import json, sys
|
|
31
|
+
try:
|
|
32
|
+
data = json.load(sys.stdin)
|
|
33
|
+
except Exception:
|
|
34
|
+
sys.exit(0)
|
|
35
|
+
roots = data.get("workspace_roots") or []
|
|
36
|
+
if roots:
|
|
37
|
+
print(roots[0])
|
|
38
|
+
' 2>/dev/null)"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]; then
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
cd "$WORKSPACE" 2>/dev/null || exit 0
|
|
46
|
+
|
|
47
|
+
if [ ! -x ./agent-config ]; then
|
|
48
|
+
exit 0
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
printf '%s' "$EVENT_DATA" \
|
|
52
|
+
| ./agent-config onboarding-gate:hook --platform augment \
|
|
53
|
+
>/dev/null 2>&1 || true
|
|
54
|
+
|
|
55
|
+
exit 0
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Cline universal hook trampoline (Phase 7.6, hook-architecture-v1.md).
|
|
3
|
+
#
|
|
4
|
+
# Routes user-scope `~/Documents/Cline/Hooks/<HookName>` events into
|
|
5
|
+
# the active workspace's `./agent-config dispatch:hook`. Project-scope
|
|
6
|
+
# `.clinerules/hooks/<HookName>` does NOT need this trampoline —
|
|
7
|
+
# install.py `ensure_cline_bridge()` writes per-event scripts there
|
|
8
|
+
# that dispatch directly because Cline fires project hooks with the
|
|
9
|
+
# workspace as cwd.
|
|
10
|
+
#
|
|
11
|
+
# Cline event payload (per docs.cline.bot/customization/hooks):
|
|
12
|
+
# { "taskId": "...", "hookName": "...", "clineVersion": "...",
|
|
13
|
+
# "timestamp": "...", "workspaceRoots": ["<path>"], "userId": "...",
|
|
14
|
+
# "model": { ... }, "<hookName-camelCase>": { ... }, ... }
|
|
15
|
+
#
|
|
16
|
+
# Output (read by Cline): JSON `{ cancel: bool, contextModification?,
|
|
17
|
+
# errorMessage? }`. Per agent-config we always emit an empty `{}` —
|
|
18
|
+
# concerns are observe-only at this layer; chat-history /
|
|
19
|
+
# roadmap-progress / context-hygiene never block, and onboarding-gate
|
|
20
|
+
# blocks via state file, not via cancel-on-TaskStart.
|
|
21
|
+
#
|
|
22
|
+
# Phase 7.6 amendment — Windows path guard: Cline upstream issue
|
|
23
|
+
# cline#8073 reports `workspaceRoots` containing CRLF or
|
|
24
|
+
# Windows-style paths on certain hosts. We only act when the first
|
|
25
|
+
# entry is a directory; other shapes silently no-op.
|
|
26
|
+
|
|
27
|
+
set -u
|
|
28
|
+
|
|
29
|
+
# Args from the hook script that wraps this trampoline:
|
|
30
|
+
# $1 = agent-config event name (session_start, post_tool_use, …)
|
|
31
|
+
# $2 = Cline-native hook name (TaskStart, PostToolUse, …)
|
|
32
|
+
EVENT="${1-}"
|
|
33
|
+
NATIVE_EVENT="${2-}"
|
|
34
|
+
|
|
35
|
+
if [ -z "$EVENT" ]; then
|
|
36
|
+
printf '%s\n' '{}'
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
EVENT_DATA="$(cat)"
|
|
41
|
+
|
|
42
|
+
WORKSPACE=""
|
|
43
|
+
if command -v jq >/dev/null 2>&1; then
|
|
44
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" \
|
|
45
|
+
| jq -r '.workspaceRoots[0] // empty' 2>/dev/null)"
|
|
46
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
47
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" | python3 -c '
|
|
48
|
+
import json, sys
|
|
49
|
+
try:
|
|
50
|
+
data = json.load(sys.stdin)
|
|
51
|
+
except Exception:
|
|
52
|
+
sys.exit(0)
|
|
53
|
+
roots = data.get("workspaceRoots") or []
|
|
54
|
+
if roots:
|
|
55
|
+
print(roots[0])
|
|
56
|
+
' 2>/dev/null)"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Strip CR (cline#8073 — Windows hosts can emit CRLF) and reject
|
|
60
|
+
# obviously-bogus shapes before the cd.
|
|
61
|
+
WORKSPACE="${WORKSPACE%$'\r'}"
|
|
62
|
+
|
|
63
|
+
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]; then
|
|
64
|
+
printf '%s\n' '{}'
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
cd "$WORKSPACE" 2>/dev/null || { printf '%s\n' '{}'; exit 0; }
|
|
69
|
+
|
|
70
|
+
if [ ! -x ./agent-config ]; then
|
|
71
|
+
printf '%s\n' '{}'
|
|
72
|
+
exit 0
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
printf '%s' "$EVENT_DATA" \
|
|
76
|
+
| ./agent-config dispatch:hook \
|
|
77
|
+
--platform cline \
|
|
78
|
+
--event "$EVENT" \
|
|
79
|
+
--native-event "$NATIVE_EVENT" \
|
|
80
|
+
>/dev/null 2>&1 || true
|
|
81
|
+
|
|
82
|
+
# Cline expects a JSON envelope on stdout; empty object = "no cancel,
|
|
83
|
+
# no context modification, no error". Errors from concerns surface
|
|
84
|
+
# through agents/state/.dispatcher/<session_id>/ per Phase 7.3.
|
|
85
|
+
printf '%s\n' '{}'
|
|
86
|
+
exit 0
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Cursor universal hook trampoline (Phase 7.5, hook-architecture-v1.md).
|
|
3
|
+
#
|
|
4
|
+
# Routes user-scope `~/.cursor/hooks.json` events into the active
|
|
5
|
+
# workspace's `./agent-config dispatch:hook`. Project-scope
|
|
6
|
+
# `.cursor/hooks.json` does NOT need this trampoline — install.py
|
|
7
|
+
# `ensure_cursor_bridge()` writes direct dispatch:hook commands there
|
|
8
|
+
# because the project hooks fire with the workspace as cwd.
|
|
9
|
+
#
|
|
10
|
+
# Cursor event payload (per https://cursor.com/docs/hooks):
|
|
11
|
+
# { "conversation_id": "...", "generation_id": "...",
|
|
12
|
+
# "model": "...", "hook_event_name": "...",
|
|
13
|
+
# "cursor_version": "...", "workspace_roots": ["<path>"],
|
|
14
|
+
# "user_email": "...|null", "transcript_path": "...|null", ... }
|
|
15
|
+
#
|
|
16
|
+
# Behaviour mirrors augment-dispatcher.sh:
|
|
17
|
+
# - Read JSON event from stdin into a buffer.
|
|
18
|
+
# - Extract workspace_roots[0]; bail silently when missing.
|
|
19
|
+
# - cd into that workspace; bail silently when it lacks ./agent-config.
|
|
20
|
+
# - Re-pipe the original JSON into
|
|
21
|
+
# ./agent-config dispatch:hook --platform cursor \
|
|
22
|
+
# --event $1 --native-event $2
|
|
23
|
+
# - Always exit 0 — Cursor's pre-hooks can block via exit code, but
|
|
24
|
+
# none of our concerns block; chat-history / roadmap-progress /
|
|
25
|
+
# context-hygiene are observe-only and onboarding-gate writes
|
|
26
|
+
# state without denying sessionStart.
|
|
27
|
+
|
|
28
|
+
set -u
|
|
29
|
+
|
|
30
|
+
# Args from the platform's hooks.json command string:
|
|
31
|
+
# $1 = agent-config event name (session_start, post_tool_use, …)
|
|
32
|
+
# $2 = Cursor-native event name (sessionStart, postToolUse, …)
|
|
33
|
+
EVENT="${1-}"
|
|
34
|
+
NATIVE_EVENT="${2-}"
|
|
35
|
+
|
|
36
|
+
if [ -z "$EVENT" ]; then
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
EVENT_DATA="$(cat)"
|
|
41
|
+
|
|
42
|
+
WORKSPACE=""
|
|
43
|
+
if command -v jq >/dev/null 2>&1; then
|
|
44
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" \
|
|
45
|
+
| jq -r '.workspace_roots[0] // empty' 2>/dev/null)"
|
|
46
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
47
|
+
WORKSPACE="$(printf '%s' "$EVENT_DATA" | python3 -c '
|
|
48
|
+
import json, sys
|
|
49
|
+
try:
|
|
50
|
+
data = json.load(sys.stdin)
|
|
51
|
+
except Exception:
|
|
52
|
+
sys.exit(0)
|
|
53
|
+
roots = data.get("workspace_roots") or []
|
|
54
|
+
if roots:
|
|
55
|
+
print(roots[0])
|
|
56
|
+
' 2>/dev/null)"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]; then
|
|
60
|
+
exit 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
cd "$WORKSPACE" 2>/dev/null || exit 0
|
|
64
|
+
|
|
65
|
+
if [ ! -x ./agent-config ]; then
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
printf '%s' "$EVENT_DATA" \
|
|
70
|
+
| ./agent-config dispatch:hook \
|
|
71
|
+
--platform cursor \
|
|
72
|
+
--event "$EVENT" \
|
|
73
|
+
--native-event "$NATIVE_EVENT" \
|
|
74
|
+
>/dev/null 2>&1 || true
|
|
75
|
+
|
|
76
|
+
exit 0
|