@christang/keel 5.1.1

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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +250 -0
  3. package/README.zh-CN.md +295 -0
  4. package/assets/bootstrap/AGENTS.md +9 -0
  5. package/assets/openspec/schemas/keel-spec-driven/schema.yaml +166 -0
  6. package/assets/openspec/schemas/keel-spec-driven/templates/design.md +52 -0
  7. package/assets/openspec/schemas/keel-spec-driven/templates/proposal.md +21 -0
  8. package/assets/openspec/schemas/keel-spec-driven/templates/spec.md +8 -0
  9. package/assets/openspec/schemas/keel-spec-driven/templates/tasks.md +68 -0
  10. package/bin/keel.js +1490 -0
  11. package/package.json +35 -0
  12. package/plugins/keel/.claude-plugin/plugin.json +17 -0
  13. package/plugins/keel/.codex-plugin/plugin.json +29 -0
  14. package/plugins/keel/agents/keel-single-task-goal-claude.md +16 -0
  15. package/plugins/keel/agents/keel-single-task-goal-codex.md +16 -0
  16. package/plugins/keel/hooks/hooks.json +30 -0
  17. package/plugins/keel/scripts/pretooluse-guard.js +156 -0
  18. package/plugins/keel/scripts/session-start.js +182 -0
  19. package/plugins/keel/skills/keel-align-expectations/SKILL.md +53 -0
  20. package/plugins/keel/skills/keel-align-expectations/references/hardware-dsl.md +21 -0
  21. package/plugins/keel/skills/keel-align-expectations/references/hardware.md +21 -0
  22. package/plugins/keel/skills/keel-align-expectations/references/web.md +21 -0
  23. package/plugins/keel/skills/keel-debug-failure/SKILL.md +41 -0
  24. package/plugins/keel/skills/keel-handoff/SKILL.md +45 -0
  25. package/plugins/keel/skills/keel-review-checklist/SKILL.md +73 -0
  26. package/plugins/keel/skills/keel-run-single-task-goal/SKILL.md +68 -0
  27. package/plugins/keel/skills/keel-tdd-or-test-first/SKILL.md +45 -0
  28. package/scripts/install_to_repo.py +1122 -0
  29. package/scripts/run_python.js +63 -0
  30. package/scripts/validate_plugin.py +9869 -0
  31. package/src/core/capabilities.js +291 -0
  32. package/src/core/context.js +514 -0
  33. package/src/core/gates.js +643 -0
  34. package/src/core/goal.js +230 -0
  35. package/src/core/guard.js +295 -0
  36. package/src/core/helper.js +319 -0
  37. package/src/core/projection.js +195 -0
  38. package/src/core/task-contract.js +736 -0
  39. package/src/core/tasksview.js +123 -0
@@ -0,0 +1,166 @@
1
+ name: keel-spec-driven
2
+ version: 1
3
+ description: Keel OpenSpec workflow - proposal -> specs -> design -> executable tasks
4
+ artifacts:
5
+ - id: proposal
6
+ generates: proposal.md
7
+ description: Initial proposal document outlining the change
8
+ template: proposal.md
9
+ instruction: >
10
+ Create the proposal document that establishes WHY this change is needed.
11
+
12
+ Sections:
13
+ - **Why**: 1-2 sentences on the problem or opportunity.
14
+ - **What Changes**: Bullet list of changes. Mark breaking changes with **BREAKING**.
15
+ - **Capabilities**: Identify new or modified specs.
16
+ - **Impact**: Affected code, APIs, dependencies, systems, or risks.
17
+
18
+ Keep it concise. Implementation details belong in design.md.
19
+ requires: []
20
+ - id: specs
21
+ generates: specs/**/*.md
22
+ description: Detailed specifications for the change
23
+ template: spec.md
24
+ instruction: >
25
+ Create specification files that define WHAT the system should do.
26
+
27
+ Create one spec file per capability listed in proposal.md.
28
+
29
+ Delta operations use ## headers:
30
+ - **ADDED Requirements**
31
+ - **MODIFIED Requirements**
32
+ - **REMOVED Requirements**
33
+ - **RENAMED Requirements**
34
+
35
+ Each requirement uses `### Requirement: <name>`.
36
+ Each scenario uses exactly `#### Scenario: <name>` with WHEN/THEN bullets.
37
+ requires:
38
+ - proposal
39
+ - id: design
40
+ generates: design.md
41
+ description: Technical design document with implementation details
42
+ template: design.md
43
+ instruction: >
44
+ Create design.md when the change has cross-module behavior, external
45
+ dependencies, data model changes, security/performance/migration
46
+ complexity, or decisions that should be recorded before coding.
47
+
48
+ Include context, goals/non-goals, decisions with rationale, risks and
49
+ mitigations, migration/rollback notes when relevant, and open questions.
50
+ Critical statements that affect scope, Acceptance, completion, or
51
+ execution boundaries use D<n> for decisions, F<n> for verified facts,
52
+ A<n> for assumptions, or Q<n> for unresolved questions. Record a basis
53
+ for each; A/Q statements also name a resolution gate or durable owner.
54
+ Ordinary narrative remains unnumbered.
55
+ If authoring uncertainty or hidden-knowledge risk blocks design or task
56
+ decisions, use risk-triggered deep alignment through
57
+ `keel-align-expectations` before finalizing design.md or tasks.md; it
58
+ is not an execution, review, or export gate. Domain reference guidance may identify hidden-knowledge
59
+ assumptions that belong in design.md, specs, or tasks. Compressed recovery
60
+ context belongs in durable OpenSpec artifacts or archive evidence, not
61
+ `keel/HANDOFF.md`.
62
+ When any task declares `Coupling: required`, complete the Coupled
63
+ Iteration Contract with the coupled artifacts, invalidation triggers,
64
+ required regeneration, final assertions, conflict authority, and
65
+ baseline policy.
66
+ requires:
67
+ - proposal
68
+ - id: tasks
69
+ generates: tasks.md
70
+ description: Implementation checklist with Keel execution contracts
71
+ template: tasks.md
72
+ instruction: >
73
+ Create tasks.md as the implementation checklist and execution contract.
74
+
75
+ Every executable task MUST be a checkbox authored in the compact v4 form
76
+ from the template: Covers, Touch, Verify (Strategy plus ordered M<n>
77
+ public checks), and an Evidence anchor with its Contract line, per-check
78
+ results, semantic Review, and Blocker state. Omitted fields inherit
79
+ versioned keel-task-capsule/v1 defaults: Owner is the current Keel
80
+ agent, Mode is implementation, Read is the change artifacts plus
81
+ discovered repository context, Acceptance derives from the resolved
82
+ Covers authority, the Autonomy boundary is hard-stop, and Coupling is
83
+ none. Exceptional boundaries are declared only when they differ from
84
+ those defaults: Mode, extra Read paths, a task-specific Acceptance
85
+ delta, Execution recommendation and Rationale, a pre-authorized
86
+ fallback in the Autonomy boundary, Coupling with its Candidate Boundary
87
+ and candidate Stop Rules, or extra Stop if limits.
88
+ Compatible expanded v3 tasks compile through the same parser, but
89
+ explicit legacy fields (including Commands or a Report section) must
90
+ agree with the v4 defaults and conditional rules; contradictions fail
91
+ with migration diagnostics, and newly authored tasks use only the
92
+ compact form.
93
+ Verify selects the least-cost strategy that still proves the resolved
94
+ Acceptance: vertical-tdd, regression-first, characterization,
95
+ snapshot-characterization, rendered-behavior, or evidence-first.
96
+ Red-green strategies record per-label `.red` and `.green` Evidence for
97
+ the same check before completion.
98
+ The Task Authoring Gate requires every relevant critical expectation to
99
+ be covered by a slice, deferred to a durable owner, or explicitly
100
+ discarded with rationale before the slice can be selected for execution.
101
+ Accepted hidden-knowledge assumptions from risk-triggered deep
102
+ alignment or a domain reference are critical expectations when they
103
+ affect completion definition or execution boundaries.
104
+ Covers references the relevant D/F/A/Q identifiers. An unresolved Q<n>
105
+ without an authorized fallback blocks implementation.
106
+ A new or materially expanded dedicated skill remains non-executable until
107
+ design or task evidence identifies authoritative sources, provenance and license
108
+ implications, realistic positive and negative trigger cases, and
109
+ required real-task evidence. Portable source authority and declared target
110
+ projections must also be named when they affect Touch or Commands.
111
+
112
+ Execution recommendation and Rationale are advisory notes for the current
113
+ Keel agent. Keel-managed work executes in the current agent conversation;
114
+ do not hand execution to another agent, subagent, or operator unless the
115
+ selected task or user explicitly authorizes it.
116
+ Autonomy boundary defaults to hard-stop. A pre-authorized fallback must
117
+ state an exact reversible bound and the evidence required after use.
118
+
119
+ Use `Coupling: none` by default. When `Coupling: required`, define one
120
+ complete candidate, its allowed provisional failures, completion gate,
121
+ final assertions, retry counting, immediate task-stop conditions, and
122
+ evidence. The task must agree with design.md's Coupled Iteration Contract.
123
+
124
+ `/opsx:apply` selects unchecked tasks from this file. The current agent may
125
+ read any repository file needed for the selected task; Read lists required
126
+ starting context, not a read allowlist. The Slice Start Gate requires each
127
+ selected current slice or contiguous slice group to name source
128
+ expectations and compile to a capsule whose Read, Touch, Acceptance,
129
+ verification checks, and Stop/Autonomy boundaries are sufficient to
130
+ execute without guessing. Rough
131
+ future slices may remain drafts, but cannot be selected for
132
+ implementation or marked complete. The current agent may only modify files
133
+ listed under Touch for the selected task. If implementation requires files
134
+ outside Touch, broader design work, or an interface/security boundary
135
+ change not covered by design.md, stop and report an Out-of-scope Need.
136
+ Before task completion, Evidence records the current agent's semantic
137
+ Review with Status, Acceptance check, Scope check, and Findings. Findings
138
+ are `none` or name a durable OpenSpec/archive owner or discard rationale;
139
+ HANDOFF is never the owner.
140
+ requires:
141
+ - specs
142
+ - design
143
+ apply:
144
+ requires:
145
+ - tasks
146
+ tracks: tasks.md
147
+ instruction: |
148
+ Use `/opsx:apply` as the implementation entry for Keel-managed work.
149
+
150
+ Apply workflow:
151
+ 1. Read the current change's proposal.md, specs, design.md when present, and tasks.md.
152
+ 2. Select one unchecked task or a small contiguous group of unchecked tasks from tasks.md.
153
+ 3. Run the Task Authoring Gate: every relevant critical expectation must be covered by a selected slice, deferred to a durable owner, or explicitly discarded with rationale.
154
+ 4. Run the Slice Start Gate: every selected current slice must name source expectations and compile to a complete keel-task-capsule/v1 contract from its compact Covers, Touch, Verify, and Evidence fields plus any declared exceptional Mode, Read, Acceptance delta, Autonomy boundary, Coupling/Candidate Boundary, or Stop if clauses.
155
+ 5. If a selected task lacks an execution contract, source expectations, or accepted hidden-knowledge assumptions raised by risk-triggered deep alignment or a domain reference, update OpenSpec first instead of dispatching implementation.
156
+ 6. Rough future slices may remain non-executable drafts, but they cannot be selected for implementation or marked complete.
157
+ 7. The current Keel agent remains task owner and executor. Treat any Execution recommendation as an advisory implementation note, not as a completion gate.
158
+ 8. Do not hand Keel-managed execution to another agent, subagent, or operator unless the selected task or user explicitly authorizes it. Keep task selection, implementation, verification, and failure recovery in the current agent conversation.
159
+ 9. Use the current checkout and selected task contract. Verification failure or context pressure preserves the checkout; continue from evidence, record a blocker, or explicitly roll back to last-green only when authorized.
160
+ 10. When `Coupling: required`, verify design.md contains a Coupled Iteration Contract and that the task defines a complete candidate, completion gate, and evidence. If not, update OpenSpec instead of execution.
161
+ 11. The current agent may read any repository file needed for the selected task, but repository-wide read authority is read-only and does not expand write authority.
162
+ 12. Modify only files listed under Touch. If modifying any other file is required, stop and report an Out-of-scope Need with file or area, why needed, consequence if unchanged, minimal proposed change, and evidence.
163
+ 13. Do not commit or push unless the selected task or human instruction explicitly allows it.
164
+ 14. After each iteration, compare Changed Files and command evidence with the selected task contract before checking tasks complete.
165
+ 15. Run `keel-review-checklist` only at completion gates: after a complete task group, before `/opsx:sync openspec/changes/<change>/tasks.md` or `/opsx:archive openspec/changes/<change>/tasks.md`, before meaningful handoff, or when implementation reports risks, follow-ups, or out-of-scope need. The Claude target's Keel Hook completion gate checks M-command evidence for these direct command paths.
166
+ 16. Before archive or handoff, unresolved follow-ups must be owned by current OpenSpec tasks, a new OpenSpec change, archive evidence, or an explicit discard reason.
@@ -0,0 +1,52 @@
1
+ ## Context
2
+
3
+ <!-- Background and current state. -->
4
+
5
+ ## Goals / Non-Goals
6
+
7
+ **Goals:**
8
+ <!-- What this design aims to achieve. -->
9
+
10
+ **Non-Goals:**
11
+ <!-- What is explicitly out of scope. -->
12
+
13
+ ## Decisions
14
+
15
+ <!-- Key design decisions and rationale. Critical statements that affect scope,
16
+ Acceptance, completion, or execution boundaries may use:
17
+ - D<n> — accepted decision; Basis: <rationale or authority>
18
+ - F<n> — verified fact; Basis: <source and verification date>
19
+ Ordinary narrative stays unnumbered. -->
20
+
21
+ ## Hidden Knowledge / Assumptions
22
+
23
+ <!-- Accepted hidden-knowledge assumptions from risk-triggered grill or domain
24
+ profiles. Critical assumptions use A<n>, record Basis, and name Resolve by or a
25
+ durable Owner. Put compressed recovery context here when future sessions need
26
+ it; keel/HANDOFF.md should only point to durable owners. Use "None." when empty. -->
27
+
28
+ ## Coupled Iteration Contract
29
+
30
+ <!-- Required only when a task declares Coupling: required. Define coupled
31
+ artifacts, invalidation triggers, required regeneration, final assertions,
32
+ conflict authority, and immutable baseline policy. Do not put commands,
33
+ Touch scope, or retry counts here. -->
34
+
35
+ <!-- Use these exact labels when this contract is required:
36
+ - Coupled artifacts:
37
+ - Invalidation triggers:
38
+ - Required regeneration:
39
+ - Final assertions:
40
+ - Conflict authority:
41
+ - Baseline policy:
42
+ -->
43
+
44
+ ## Risks / Trade-offs
45
+
46
+ <!-- Known risks and mitigations. -->
47
+
48
+ ## Open Questions
49
+
50
+ <!-- Critical unresolved questions use Q<n>, record Basis, and name Resolve by
51
+ or a durable Owner. An executable task must not cover an unresolved Q<n>
52
+ without an authorized fallback. Use "None." when empty. -->
@@ -0,0 +1,21 @@
1
+ ## Why
2
+
3
+ <!-- Explain the motivation for this change. What problem does this solve? Why now? -->
4
+
5
+ ## What Changes
6
+
7
+ <!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
8
+
9
+ ## Capabilities
10
+
11
+ ### New Capabilities
12
+ <!-- Capabilities being introduced. Use kebab-case identifiers. Each creates specs/<name>/spec.md. -->
13
+ - `<name>`: <brief description of what this capability covers>
14
+
15
+ ### Modified Capabilities
16
+ <!-- Existing capabilities whose requirements are changing. Leave empty if no spec-level behavior changes. -->
17
+ - `<existing-name>`: <what requirement is changing>
18
+
19
+ ## Impact
20
+
21
+ <!-- Affected code, APIs, dependencies, systems, commands, or risks. -->
@@ -0,0 +1,8 @@
1
+ ## ADDED Requirements
2
+
3
+ ### Requirement: <!-- requirement name -->
4
+ <!-- requirement text -->
5
+
6
+ #### Scenario: <!-- scenario name -->
7
+ - **WHEN** <!-- condition -->
8
+ - **THEN** <!-- expected outcome -->
@@ -0,0 +1,68 @@
1
+ <!-- Compact v4 task source (keel-task-capsule/v1, defaults version 1).
2
+ Record only task-specific authority. Omitted fields inherit versioned
3
+ defaults: Owner is the current Keel agent, Mode is implementation, Read
4
+ is the change proposal/design/specs/tasks plus discovered repository
5
+ context, Acceptance derives from Covers, autonomy defaults to hard-stop,
6
+ Coupling defaults to none, helpers stay read-only/evidence-only, and
7
+ commit, push, sync, archive, and cross-task continuation stay
8
+ unauthorized. Declare a field only when it differs from these defaults. -->
9
+
10
+ ## 1. <!-- Task Group Name -->
11
+
12
+ - [ ] 1.1 <!-- Task description -->
13
+ - Covers:
14
+ - <source expectation: spec scenario as `capability / requirement or scenario heading`, hidden-knowledge assumption, domain profile requirement, or critical D<n>/F<n>/A<n>/Q<n>; an unresolved Q<n> requires an authorized fallback>
15
+ - Touch:
16
+ - <path>
17
+ - Verify:
18
+ <!-- verification discipline: Strategy is one of vertical-tdd,
19
+ regression-first, characterization, snapshot-characterization,
20
+ rendered-behavior, or evidence-first. Each M<n> check must prove the
21
+ resolved Acceptance through the public interface, not build-only or
22
+ shape-only evidence. Red-green strategies record per-label `.red` and
23
+ `.green` Evidence entries for the same check before completion. -->
24
+ - Strategy: <strategy>
25
+ - M1: <public behavior check>
26
+ - Evidence:
27
+ - Contract: pending task-start capsule and fingerprint
28
+ - M1: pending
29
+ - Review:
30
+ <!-- Findings: none, a durable OpenSpec/archive owner, or an explicit discard rationale -->
31
+ - Status: pending
32
+ - Acceptance check: pending
33
+ - Scope check: pending
34
+ - Findings: pending
35
+ - Blocker: none
36
+
37
+ <!-- Exceptional boundaries are declared only when they differ from defaults:
38
+ - Mode: diagnose-only (with `Touch: none`) or plan-first
39
+ - Read: additional required starting context beyond the base set
40
+ - Acceptance: a task-specific observable delta the Covers authority does not express
41
+ - Execution recommendation / Rationale: advisory notes for the current agent
42
+ - Autonomy boundary: a pre-authorized fallback with its exact reversible bound and required evidence
43
+ - Coupling: required, with the design.md Coupled Iteration Contract, one
44
+ complete candidate, Candidate Boundary, completion-gate final assertions,
45
+ and candidate-level Stop Rules
46
+ - Stop if: extra hard limits beyond the standard prohibitions
47
+ Requires modifying files outside Touch. always remains a stop condition. -->
48
+
49
+ ## 2. <!-- Task Group Name -->
50
+
51
+ - [ ] 2.1 <!-- Diagnose-only example: exceptional Mode and no-write scope are declared -->
52
+ - Mode: diagnose-only
53
+ - Covers:
54
+ - <source expectation or critical D/F/A statement being diagnosed>
55
+ - Touch:
56
+ - none
57
+ - Verify:
58
+ - Strategy: evidence-first
59
+ - M1: <reproduction or diagnosis check with its observable evidence>
60
+ - Evidence:
61
+ - Contract: pending task-start capsule and fingerprint
62
+ - M1: pending
63
+ - Review:
64
+ - Status: pending
65
+ - Acceptance check: pending
66
+ - Scope check: pending
67
+ - Findings: pending
68
+ - Blocker: none