@cassiomc1/forgeloop 0.1.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/.cursor/rules/project-loop.mdc +18 -0
- package/.forgeloop/.gitignore +2 -0
- package/.github/copilot-instructions.md +16 -0
- package/AGENTS.md +16 -0
- package/AGENT_COMPATIBILITY.md +147 -0
- package/CLAUDE.md +14 -0
- package/CONTRACT_COVERAGE.md +27 -0
- package/DELEGATION_PROTOCOL.md +91 -0
- package/ENG/accessibility-eng.md +155 -0
- package/ENG/clean-code-eng.md +223 -0
- package/ENG/design-code-eng.md +511 -0
- package/ENG/games-code-design-web-eng.md +751 -0
- package/ENG/perf-code-eng.md +441 -0
- package/ENG/premium-sites-studio-eng.md +320 -0
- package/ENG/sec-code-eng.md +706 -0
- package/ENG/test-code-eng.md +257 -0
- package/EXECUTION_STATE.md +107 -0
- package/GUIDE_ROUTER.md +274 -0
- package/LICENSE +21 -0
- package/LICENSE-DOCS.md +13 -0
- package/LOOP_ENGINEERING.md +551 -0
- package/LOOP_SYSTEM_DESIGN.md +394 -0
- package/ORCHESTRATOR_INTEGRATION.md +106 -0
- package/PROJECT_PROFILE.md +124 -0
- package/QUALITY_SCORECARD.md +54 -0
- package/README.md +492 -0
- package/TERMINOLOGY.md +21 -0
- package/THIRD_PARTY_NOTICES.md +129 -0
- package/THREAT_MODEL.md +35 -0
- package/package.json +51 -0
- package/schemas/delegated-result.schema.json +33 -0
- package/schemas/evidence.schema.json +15 -0
- package/schemas/execution-receipt.schema.json +46 -0
- package/schemas/routing-input.schema.json +17 -0
- package/schemas/routing-result.schema.json +17 -0
- package/schemas/task-brief.schema.json +24 -0
- package/schemas/work-state.schema.json +46 -0
- package/src/cli.js +341 -0
- package/src/commands/clear-state.js +11 -0
- package/src/commands/doctor.js +165 -0
- package/src/commands/init.js +42 -0
- package/src/commands/inspect.js +17 -0
- package/src/commands/route.js +32 -0
- package/src/commands/status.js +29 -0
- package/src/commands/update.js +109 -0
- package/src/commands/validate-protocol.js +133 -0
- package/src/commands/validate-receipt.js +19 -0
- package/src/commands/validate-state.js +30 -0
- package/src/core/agent-support.js +89 -0
- package/src/core/conformance.js +133 -0
- package/src/core/delegation.js +283 -0
- package/src/core/evidence.js +56 -0
- package/src/core/filesystem.js +122 -0
- package/src/core/inspect.js +115 -0
- package/src/core/json-safety.js +54 -0
- package/src/core/manifest.js +75 -0
- package/src/core/protocol.js +81 -0
- package/src/core/receipt.js +129 -0
- package/src/core/repository.js +19 -0
- package/src/core/router.js +296 -0
- package/src/core/schema-validation.js +179 -0
- package/src/core/templates.js +56 -0
- package/src/core/work-state.js +471 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
# Loop Engineering — Universal Execution Protocol
|
|
2
|
+
|
|
3
|
+
> Canonical operating cycle for this kit. Agent adapters point here; specialized
|
|
4
|
+
> technical rules remain in the guides selected through
|
|
5
|
+
> [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md).
|
|
6
|
+
|
|
7
|
+
## Core principle
|
|
8
|
+
|
|
9
|
+
Never treat a request as an isolated instruction or the first plausible answer
|
|
10
|
+
as completion.
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
RECEIVE REQUEST
|
|
14
|
+
↓
|
|
15
|
+
DISCOVER CONTEXT
|
|
16
|
+
↓
|
|
17
|
+
DEFINE CONTRACT
|
|
18
|
+
↓
|
|
19
|
+
SELECT GUIDES
|
|
20
|
+
↓
|
|
21
|
+
PLAN → EXECUTE → VERIFY
|
|
22
|
+
↓
|
|
23
|
+
┌─────────┴─────────┐
|
|
24
|
+
│ │
|
|
25
|
+
PASSED FAILED
|
|
26
|
+
│ │
|
|
27
|
+
PROPORTIONAL REGRESSION DIAGNOSE CAUSE
|
|
28
|
+
│ │
|
|
29
|
+
FINISH CORRECT AND VERIFY
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The loop creates real feedback until objective criteria are met. It does not
|
|
33
|
+
authorize infinite execution, scope expansion, or unrequested external action.
|
|
34
|
+
|
|
35
|
+
## Protocol version and evidence contract
|
|
36
|
+
|
|
37
|
+
The portable protocol currently uses `protocol-version: 1`. This version is
|
|
38
|
+
independent of the npm package version and is carried by structured routing,
|
|
39
|
+
state, receipt, and delegation artifacts.
|
|
40
|
+
|
|
41
|
+
Every result separates:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Observed current command, file, hash, or test evidence
|
|
45
|
+
Inferred conclusion derived from observed evidence
|
|
46
|
+
Not verified check not run or target outside the environment
|
|
47
|
+
Blocked genuine external condition preventing safe progress
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Do not present an inference, an unrun check, or a local result as observed
|
|
51
|
+
proof. Local success never implies publication, deployment, or remote-check
|
|
52
|
+
success.
|
|
53
|
+
|
|
54
|
+
The protocol-support CLI is local and offline-capable by default. It sends no
|
|
55
|
+
telemetry, does not require a central trace server, and never executes commands
|
|
56
|
+
found in untrusted profile, receipt, or state data.
|
|
57
|
+
|
|
58
|
+
## Failure taxonomy, retry, and loop invariants
|
|
59
|
+
|
|
60
|
+
The protocol uses these stable failure classes:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
CONTRACT_FAILURE
|
|
64
|
+
DISCOVERY_FAILURE
|
|
65
|
+
ROUTING_FAILURE
|
|
66
|
+
IMPLEMENTATION_FAILURE
|
|
67
|
+
VERIFICATION_FAILURE
|
|
68
|
+
REGRESSION_FAILURE
|
|
69
|
+
REVIEW_FAILURE
|
|
70
|
+
CAPABILITY_FAILURE
|
|
71
|
+
AUTHORITY_FAILURE
|
|
72
|
+
ENVIRONMENT_FAILURE
|
|
73
|
+
EXTERNAL_SERVICE_FAILURE
|
|
74
|
+
STALE_STATE_FAILURE
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For every failure, record the class, hypothesis, evidence, and next safe
|
|
78
|
+
action. A retry is allowed only when new diagnostic evidence or a changed
|
|
79
|
+
hypothesis exists. The same hypothesis with the same evidence is not an
|
|
80
|
+
immediate retry. Repeated review/fix cycles are bounded by the task contract;
|
|
81
|
+
an unavailable external dependency becomes a blocker rather than a spin loop.
|
|
82
|
+
|
|
83
|
+
The loop invariants are:
|
|
84
|
+
|
|
85
|
+
1. no completion claim without current verification evidence;
|
|
86
|
+
2. no route without a reason code;
|
|
87
|
+
3. no retry without new evidence or a changed hypothesis;
|
|
88
|
+
4. no destructive action without validated authority and target;
|
|
89
|
+
5. no project-profile fact without a source;
|
|
90
|
+
6. no external publication implied by local success;
|
|
91
|
+
7. no skipped failed check silently treated as passed;
|
|
92
|
+
8. no unrelated refactor during uncertain diagnosis;
|
|
93
|
+
9. no secret in the profile, work state, receipt, or delegation artifacts;
|
|
94
|
+
10. no independent-agent claim when only self-review occurred.
|
|
95
|
+
|
|
96
|
+
The serializable phase and transition contract is maintained in
|
|
97
|
+
[`ORCHESTRATOR_INTEGRATION.md`](./ORCHESTRATOR_INTEGRATION.md). It is a host
|
|
98
|
+
integration boundary, not an execution runtime; semantic validation checks that
|
|
99
|
+
its phase list, transitions, invariants, schema version, and no-runtime markers
|
|
100
|
+
remain aligned with this loop.
|
|
101
|
+
|
|
102
|
+
## Workflow state semantics
|
|
103
|
+
|
|
104
|
+
The canonical phases are `RECEIVED`, `DISCOVERING`, `CONTRACT_READY`,
|
|
105
|
+
`ROUTED`, `DESIGNING`, `PLANNED`, `EXECUTING`, `VERIFYING`, `DIAGNOSING`,
|
|
106
|
+
`CORRECTING`, `REVIEWING`, `COMPLETE`, and `BLOCKED`. A task may skip
|
|
107
|
+
proportional phases, but:
|
|
108
|
+
|
|
109
|
+
- `COMPLETE` requires verification evidence;
|
|
110
|
+
- `BLOCKED` requires a blocker category and evidence;
|
|
111
|
+
- `CORRECTING` requires a diagnosed hypothesis;
|
|
112
|
+
- `ROUTED` requires at least one route reason, even if no technical guide is
|
|
113
|
+
selected for documentation-only work;
|
|
114
|
+
- `REVIEWING` cannot claim independent review when reviewer and implementer
|
|
115
|
+
identities are equal.
|
|
116
|
+
|
|
117
|
+
Resume rules are conservative: revalidate branch, HEAD, contract fingerprint,
|
|
118
|
+
protocol version, and required artifacts before continuing; never rerun a
|
|
119
|
+
completed destructive or publication action automatically; rerun cheap
|
|
120
|
+
verification when state is stale; and clear only `.forgeloop/work-state.json`
|
|
121
|
+
when abandoned state must be removed.
|
|
122
|
+
|
|
123
|
+
## Execution contract
|
|
124
|
+
|
|
125
|
+
Before changing files, translate the request into a contract proportional to
|
|
126
|
+
the task:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
OBJECTIVE
|
|
130
|
+
Observable state that must exist at the end.
|
|
131
|
+
|
|
132
|
+
CONTEXT
|
|
133
|
+
Relevant files, modules, services, data, dependencies, and rules.
|
|
134
|
+
|
|
135
|
+
DELIVERABLES
|
|
136
|
+
Expected changes, artifacts, or answers.
|
|
137
|
+
|
|
138
|
+
CONSTRAINTS
|
|
139
|
+
What must not be broken, removed, published, or assumed.
|
|
140
|
+
|
|
141
|
+
RISKS
|
|
142
|
+
Regression, security, data, compatibility, and external effects.
|
|
143
|
+
|
|
144
|
+
VERIFICATION
|
|
145
|
+
Checks capable of demonstrating the result.
|
|
146
|
+
|
|
147
|
+
SUCCESS
|
|
148
|
+
Objective conditions that must be true.
|
|
149
|
+
|
|
150
|
+
STOP
|
|
151
|
+
Verified success or a genuine external blocker.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Do not interrupt the user for information that can be discovered safely in the
|
|
155
|
+
project. Request a decision when legitimate alternatives produce materially
|
|
156
|
+
different outcomes, authority is missing, or the action is destructive.
|
|
157
|
+
|
|
158
|
+
### Classify the request
|
|
159
|
+
|
|
160
|
+
- **Answer, explain, or review:** inspect and report evidence; do not make implicit changes.
|
|
161
|
+
- **Diagnose:** reproduce and determine the cause; implement only when a fix is in scope.
|
|
162
|
+
- **Create or change:** implement, test, and document in proportion to risk.
|
|
163
|
+
- **Publish or operate external systems:** confirm the target and authority before changing state.
|
|
164
|
+
- **Delete or overwrite:** resolve the exact target, prefer recoverable methods, and verify the result.
|
|
165
|
+
|
|
166
|
+
The user's latest explicit instruction replaces incompatible earlier requests
|
|
167
|
+
but does not silently broaden scope.
|
|
168
|
+
|
|
169
|
+
## Project discovery
|
|
170
|
+
|
|
171
|
+
Read the closest instructions for the directory in scope. Then inspect only
|
|
172
|
+
sources that exist and are relevant:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
AGENTS.md
|
|
176
|
+
CLAUDE.md
|
|
177
|
+
README.md
|
|
178
|
+
CONTRIBUTING.md
|
|
179
|
+
PROJECT_PROFILE.md
|
|
180
|
+
package.json
|
|
181
|
+
pyproject.toml
|
|
182
|
+
requirements.txt
|
|
183
|
+
Cargo.toml
|
|
184
|
+
go.mod
|
|
185
|
+
Makefile
|
|
186
|
+
docker-compose.yml
|
|
187
|
+
Dockerfile
|
|
188
|
+
.github/workflows/
|
|
189
|
+
docs/
|
|
190
|
+
src/
|
|
191
|
+
tests/
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Discover before inferring:
|
|
195
|
+
|
|
196
|
+
- product, stack, platforms, and architecture;
|
|
197
|
+
- official development, lint, test, typecheck, and build commands;
|
|
198
|
+
- CI, release, deployment, and environments;
|
|
199
|
+
- Git state and pre-existing changes;
|
|
200
|
+
- external services, persistence, and security surfaces;
|
|
201
|
+
- browsers, devices, and accessibility requirements;
|
|
202
|
+
- project-specific decisions.
|
|
203
|
+
|
|
204
|
+
A text reference to a technology does not prove it is active. Confirm it through
|
|
205
|
+
manifests, imports, configuration, execution, or authoritative documentation.
|
|
206
|
+
|
|
207
|
+
### Persistent profile
|
|
208
|
+
|
|
209
|
+
Use [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) as a cache of durable facts:
|
|
210
|
+
|
|
211
|
+
1. verify a source before recording or changing a fact;
|
|
212
|
+
2. leave unknown facts unverified;
|
|
213
|
+
3. cite a path, command, or other evidence;
|
|
214
|
+
4. never record secrets or credentials;
|
|
215
|
+
5. do not turn the profile into a task log;
|
|
216
|
+
6. preserve explicit decisions until newer evidence replaces them.
|
|
217
|
+
|
|
218
|
+
When the profile conflicts with the repository, current verifiable state wins.
|
|
219
|
+
Correct only the affected profile facts.
|
|
220
|
+
|
|
221
|
+
## Capability discovery and on-demand extensions
|
|
222
|
+
|
|
223
|
+
When a task may require image, video, document, audio, OCR, grounding,
|
|
224
|
+
segmentation, web search, generation, editing, long-video memory, or 3D
|
|
225
|
+
tooling, the agent must verify the capability boundary before using it:
|
|
226
|
+
|
|
227
|
+
1. Classify the operation and identify whether it needs a model capability, a
|
|
228
|
+
skill, an MCP server, an API-backed provider, or a system dependency.
|
|
229
|
+
2. Inspect the active model and harness for native support, registered skills,
|
|
230
|
+
MCP servers, and callable tools. A prompt, package name, or documentation
|
|
231
|
+
reference is not evidence that the current session can call a tool.
|
|
232
|
+
3. Reuse an existing callable capability when it is sufficient for the task.
|
|
233
|
+
4. If the required capability is missing and a keyless Qwen path exists,
|
|
234
|
+
install only the smallest matching capability, normally
|
|
235
|
+
`qwen-mm-plugins-core` for multimodal reading. Use the active harness's
|
|
236
|
+
native installation mechanism or the official
|
|
237
|
+
[Qwen-MM-Plugins](https://github.com/QwenLM/Qwen-MM-Plugins) instructions.
|
|
238
|
+
5. If the operation is API-backed, check the required environment variable or
|
|
239
|
+
configured service endpoint before enabling it. Without that prerequisite,
|
|
240
|
+
keep the optional capability disabled and continue with a keyless path or
|
|
241
|
+
report exactly what must be configured.
|
|
242
|
+
6. Verify registration and dependencies with the harness capability listing
|
|
243
|
+
and the upstream plugin's supported verification/check command.
|
|
244
|
+
7. Invoke the callable tool for the task and report missing system tools,
|
|
245
|
+
unavailable credentials, or model/harness limitations. Do not claim a
|
|
246
|
+
capability based only on a downloaded package or an unsuccessful fallback.
|
|
247
|
+
|
|
248
|
+
This installation is task-scoped and capability-scoped, not a startup-wide
|
|
249
|
+
installation of every plugin. The agent must never create, guess, persist, or
|
|
250
|
+
expose an API key. System-level package installation, global configuration,
|
|
251
|
+
network access, and credentials remain subject to host controls. If the active
|
|
252
|
+
harness cannot register skills or MCP tools, the agent must state that the
|
|
253
|
+
capability is unavailable rather than pretending to use it.
|
|
254
|
+
|
|
255
|
+
## Guide selection
|
|
256
|
+
|
|
257
|
+
Read [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) after discovery and before planning.
|
|
258
|
+
|
|
259
|
+
Required rules:
|
|
260
|
+
|
|
261
|
+
- select all guides applicable to the intent, changed surfaces, and risks;
|
|
262
|
+
- do not load every guide as a precaution;
|
|
263
|
+
- locate headings and relevant sections with `rg` before reading a long file;
|
|
264
|
+
- read the whole guide only when the task crosses the whole domain;
|
|
265
|
+
- briefly report the selected guide IDs and reason;
|
|
266
|
+
- treat optional references as options; only the task-scoped Qwen capability
|
|
267
|
+
policy above permits its matching installation, while unrelated resources
|
|
268
|
+
remain gated.
|
|
269
|
+
|
|
270
|
+
A guide provides specialized defaults. It does not replace explicit product
|
|
271
|
+
requirements, closer instructions, code evidence, or higher-level host rules.
|
|
272
|
+
|
|
273
|
+
## Design and implementation gates
|
|
274
|
+
|
|
275
|
+
### Design gate
|
|
276
|
+
|
|
277
|
+
Before behavior, feature, architecture, or instruction changes, do proportional
|
|
278
|
+
design after discovery. Work through one unresolved decision question at a
|
|
279
|
+
time, surface meaningful alternatives with tradeoffs, and obtain approval
|
|
280
|
+
before implementation. For small documentation maintenance, keep the treatment
|
|
281
|
+
compact while still confirming the objective, boundaries, and verification.
|
|
282
|
+
|
|
283
|
+
Use the [Execution contract](#execution-contract), [Project discovery](#project-discovery),
|
|
284
|
+
[Guide selection](#guide-selection), and [Proportional planning](#proportional-planning)
|
|
285
|
+
sections as the canonical sources for context, routing, and plan depth.
|
|
286
|
+
|
|
287
|
+
### Plan contract and task briefs
|
|
288
|
+
|
|
289
|
+
Every implementation plan or task brief must be self-contained for its scope
|
|
290
|
+
and state the objective, architecture, technology, global constraints, exact
|
|
291
|
+
files or interfaces, verification, and commit boundaries. Independent tasks
|
|
292
|
+
must stay independently executable without hidden dependencies on unpublished
|
|
293
|
+
conversation context.
|
|
294
|
+
|
|
295
|
+
For long or multi-task work, keep an ignored ledger scoped to the plan. Use
|
|
296
|
+
`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, and `BLOCKED` to support
|
|
297
|
+
recovery and resume for completed work, concerns, missing context, and
|
|
298
|
+
blockers rather than turning the ledger into a task log.
|
|
299
|
+
|
|
300
|
+
Use the [Execution contract](#execution-contract) for the required fields, the
|
|
301
|
+
[Project discovery](#project-discovery) and [Guide selection](#guide-selection)
|
|
302
|
+
sections for evidence and routing, and [Stop conditions](#stop-conditions) for
|
|
303
|
+
genuine blockers.
|
|
304
|
+
|
|
305
|
+
### Test-first implementation
|
|
306
|
+
|
|
307
|
+
For behavior changes, use RED → expected failure → minimal GREEN → refactor,
|
|
308
|
+
with the testing strategy and risk depth anchored in
|
|
309
|
+
[`ENG/test-code-eng.md`](./ENG/test-code-eng.md) and the
|
|
310
|
+
[Verification and regression](#verification-and-regression) plus
|
|
311
|
+
[Evidence-driven correction](#evidence-driven-correction) sections. Explicit
|
|
312
|
+
exceptions are documentation-only work, generated output, or throwaway
|
|
313
|
+
exploration that will not become maintained production behavior.
|
|
314
|
+
|
|
315
|
+
### Review and recovery
|
|
316
|
+
|
|
317
|
+
self-review is required but is not independent review. For multi-task work,
|
|
318
|
+
specification compliance before code quality: first verify that the result
|
|
319
|
+
matches the approved contract, then evaluate implementation quality. Handle one
|
|
320
|
+
finding at a time, stop after at most five review-fix rounds, and treat any
|
|
321
|
+
unresolved load-bearing finding as blocked until the contract or implementation
|
|
322
|
+
changes.
|
|
323
|
+
|
|
324
|
+
Use [Evidence-driven correction](#evidence-driven-correction) for diagnosis,
|
|
325
|
+
[Verification and regression](#verification-and-regression) for re-checking,
|
|
326
|
+
and [Stop conditions](#stop-conditions) when a blocker remains genuine.
|
|
327
|
+
|
|
328
|
+
### Worktree and capability degradation
|
|
329
|
+
|
|
330
|
+
Prefer native isolation when the harness provides it; otherwise use an approved
|
|
331
|
+
ignored local worktree and require explicit consent before working directly on
|
|
332
|
+
the main branch. When optional subagent, todo, web, or isolation capabilities
|
|
333
|
+
are missing, fall back inline or to a plan file, report the degraded mode, and
|
|
334
|
+
never invent a tool call.
|
|
335
|
+
|
|
336
|
+
Use [Capability discovery and on-demand extensions](#capability-discovery-and-on-demand-extensions)
|
|
337
|
+
for callable-tool proof, [Execution loop](#execution-loop) for scoped progress,
|
|
338
|
+
and [Stop conditions](#stop-conditions) when the missing capability removes a
|
|
339
|
+
required verification path.
|
|
340
|
+
|
|
341
|
+
## Instruction and adapter hygiene
|
|
342
|
+
|
|
343
|
+
Write canonical rules once in this file and make adapters delegate to
|
|
344
|
+
`LOOP_ENGINEERING.md`, `PROJECT_PROFILE.md`, and `GUIDE_ROUTER.md` rather than
|
|
345
|
+
copying process bodies. Adapter descriptions are trigger and reference text,
|
|
346
|
+
not duplicate policy. Mechanical contracts belong in tests. New harness
|
|
347
|
+
adapters should use the harness's native installation and context-loading path
|
|
348
|
+
without editing global configuration, and actual bootstrap or context loading
|
|
349
|
+
should be proven with a unique marker where possible.
|
|
350
|
+
|
|
351
|
+
Keep capability rules in [Capability discovery and on-demand extensions](#capability-discovery-and-on-demand-extensions),
|
|
352
|
+
routing in [Guide selection](#guide-selection), planning in
|
|
353
|
+
[Proportional planning](#proportional-planning), execution in
|
|
354
|
+
[Execution loop](#execution-loop), verification in
|
|
355
|
+
[Verification and regression](#verification-and-regression), correction in
|
|
356
|
+
[Evidence-driven correction](#evidence-driven-correction), and exit handling in
|
|
357
|
+
[Stop conditions](#stop-conditions).
|
|
358
|
+
|
|
359
|
+
## Proportional planning
|
|
360
|
+
|
|
361
|
+
### Simple task
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
Objective → small change → specific check → final review
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Medium task
|
|
368
|
+
|
|
369
|
+
```text
|
|
370
|
+
Objective → investigation → short plan → verifiable steps
|
|
371
|
+
→ related regression checks → final review
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Complex task
|
|
375
|
+
|
|
376
|
+
```text
|
|
377
|
+
Objective → system map → risks and dependencies → subtasks
|
|
378
|
+
→ per-subtask validation → integration → broad regression
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Every step must produce a testable result. Split components by responsibility
|
|
382
|
+
and keep interfaces explicit. Do not create extensive plans for trivial changes
|
|
383
|
+
or hide complex work in one vague step.
|
|
384
|
+
|
|
385
|
+
## Execution loop
|
|
386
|
+
|
|
387
|
+
1. Confirm the objective and success condition.
|
|
388
|
+
2. Collect the smallest sufficient context.
|
|
389
|
+
3. Preserve user changes and keep the diff scoped.
|
|
390
|
+
4. For bugs, reproduce the failure and capture evidence before fixing it when practical.
|
|
391
|
+
5. Make the smallest coherent change that addresses the cause or delivers the capability.
|
|
392
|
+
6. Run the specific check.
|
|
393
|
+
7. If it fails, diagnose before editing again.
|
|
394
|
+
8. After the specific check passes, run proportional regression checks.
|
|
395
|
+
9. Inspect the result and the complete diff.
|
|
396
|
+
10. Finish only with current evidence.
|
|
397
|
+
|
|
398
|
+
Do not bundle independent changes while the cause remains uncertain. Do not
|
|
399
|
+
refactor large areas merely because they could be improved.
|
|
400
|
+
|
|
401
|
+
## Verification and regression
|
|
402
|
+
|
|
403
|
+
Choose checks that match the artifact and risk.
|
|
404
|
+
|
|
405
|
+
### Code
|
|
406
|
+
|
|
407
|
+
- focused and regression tests;
|
|
408
|
+
- lint and formatting;
|
|
409
|
+
- typecheck;
|
|
410
|
+
- production build;
|
|
411
|
+
- imports, runtime errors, and public contracts;
|
|
412
|
+
- relevant compatibility and edge cases.
|
|
413
|
+
|
|
414
|
+
### Backend, APIs, and data
|
|
415
|
+
|
|
416
|
+
- status codes and payloads;
|
|
417
|
+
- authentication and authorization;
|
|
418
|
+
- validation, persistence, and idempotency;
|
|
419
|
+
- migrations, constraints, indexes, and rollback;
|
|
420
|
+
- real integrations or doubles appropriate to the test level;
|
|
421
|
+
- logs without secrets or sensitive data.
|
|
422
|
+
|
|
423
|
+
### Interfaces
|
|
424
|
+
|
|
425
|
+
- normal, loading, empty, error, and disabled states;
|
|
426
|
+
- responsiveness and lack of overflow;
|
|
427
|
+
- keyboard, focus, contrast, and applicable assistive technology;
|
|
428
|
+
- browser console;
|
|
429
|
+
- API integration;
|
|
430
|
+
- production and target-device measurement when required.
|
|
431
|
+
|
|
432
|
+
### Infrastructure and automation
|
|
433
|
+
|
|
434
|
+
- syntax and schema;
|
|
435
|
+
- permissions and variables;
|
|
436
|
+
- rollback plan;
|
|
437
|
+
- health checks;
|
|
438
|
+
- CI-equivalent execution when practical.
|
|
439
|
+
|
|
440
|
+
### Documentation
|
|
441
|
+
|
|
442
|
+
- consistency with real state;
|
|
443
|
+
- commands and paths;
|
|
444
|
+
- links and references;
|
|
445
|
+
- examples;
|
|
446
|
+
- Markdown and language.
|
|
447
|
+
|
|
448
|
+
Regression depth grows with risk: specific check, related tests, then suite,
|
|
449
|
+
build, and integration validation when reasonable.
|
|
450
|
+
|
|
451
|
+
## Evidence-driven correction
|
|
452
|
+
|
|
453
|
+
```text
|
|
454
|
+
FAILURE
|
|
455
|
+
↓
|
|
456
|
+
COLLECT COMPLETE OUTPUT
|
|
457
|
+
↓
|
|
458
|
+
IDENTIFY ROOT CAUSE
|
|
459
|
+
↓
|
|
460
|
+
FORM A TESTABLE HYPOTHESIS
|
|
461
|
+
↓
|
|
462
|
+
APPLY THE SMALLEST FIX
|
|
463
|
+
↓
|
|
464
|
+
RUN THE SPECIFIC CHECK
|
|
465
|
+
↓
|
|
466
|
+
RUN REGRESSION CHECKS
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Avoid random edits and never hide a failure by weakening verification.
|
|
470
|
+
|
|
471
|
+
If the same hypothesis fails again without new evidence:
|
|
472
|
+
|
|
473
|
+
1. stop repeating the attempt;
|
|
474
|
+
2. review assumptions, logs, and environment boundaries;
|
|
475
|
+
3. seek an independent check;
|
|
476
|
+
4. change strategy or report the genuine blocker.
|
|
477
|
+
|
|
478
|
+
An unavailable check does not pass by absence. Use an available equivalent when
|
|
479
|
+
it produces compatible evidence; otherwise request installation authority or
|
|
480
|
+
record the limitation.
|
|
481
|
+
|
|
482
|
+
## Precedence
|
|
483
|
+
|
|
484
|
+
Apply conflicts in this order:
|
|
485
|
+
|
|
486
|
+
1. platform and host-agent rules;
|
|
487
|
+
2. the user's latest explicit request;
|
|
488
|
+
3. the closest project, directory, or file instructions;
|
|
489
|
+
4. legal, security, and data-preservation requirements;
|
|
490
|
+
5. this loop contract;
|
|
491
|
+
6. the router decision;
|
|
492
|
+
7. specialized guide defaults.
|
|
493
|
+
|
|
494
|
+
Within technical scope, prioritize:
|
|
495
|
+
|
|
496
|
+
```text
|
|
497
|
+
correctness → no regression → security → product requirement
|
|
498
|
+
→ simplicity → measured performance → elegance
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
A guide never authorizes unrelated installation, publication, deletion,
|
|
502
|
+
migration, production changes, messages, or information exposure. The
|
|
503
|
+
task-scoped Qwen capability policy is the narrow exception for installing the
|
|
504
|
+
smallest missing capability when the current task requires it; host approval
|
|
505
|
+
controls and the API-credential boundary still apply.
|
|
506
|
+
|
|
507
|
+
## Stop conditions
|
|
508
|
+
|
|
509
|
+
### Verified success
|
|
510
|
+
|
|
511
|
+
- the primary requirement is met;
|
|
512
|
+
- applicable checks were run and passed;
|
|
513
|
+
- no relevant regression was found;
|
|
514
|
+
- the diff was reviewed and remains scoped;
|
|
515
|
+
- documentation was updated when necessary;
|
|
516
|
+
- residual limitations are declared.
|
|
517
|
+
|
|
518
|
+
### Genuine external blocker
|
|
519
|
+
|
|
520
|
+
- a material product decision is missing;
|
|
521
|
+
- authority for an external or destructive action is missing;
|
|
522
|
+
- an indispensable credential, service, device, or environment is unavailable;
|
|
523
|
+
- an essential check has no safe alternative;
|
|
524
|
+
- the environment prevents progress after diagnosis and distinct attempts.
|
|
525
|
+
|
|
526
|
+
Difficulty, slowness, initial uncertainty, or a preference for more context are
|
|
527
|
+
not blockers by themselves.
|
|
528
|
+
|
|
529
|
+
## Final delivery
|
|
530
|
+
|
|
531
|
+
Use the shortest report that preserves evidence:
|
|
532
|
+
|
|
533
|
+
```text
|
|
534
|
+
STATUS: COMPLETE | PARTIALLY VERIFIED | BLOCKED
|
|
535
|
+
|
|
536
|
+
Delivered:
|
|
537
|
+
- changed files or behavior.
|
|
538
|
+
|
|
539
|
+
Verified:
|
|
540
|
+
- commands, checks, and objective results.
|
|
541
|
+
|
|
542
|
+
Limitations:
|
|
543
|
+
- what was not proven and why.
|
|
544
|
+
|
|
545
|
+
Publication:
|
|
546
|
+
- commit, push, pull request, merge, or deployment state when applicable.
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Never claim that a test, build, platform, device, or integration passed without
|
|
550
|
+
a compatible check. The final response must distinguish local implementation
|
|
551
|
+
from external publication.
|