@el-j/magic-helix-core 4.0.0-beta.2 → 4.0.0-beta.3
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/dist/index-B88j4AyE.js +13 -0
- package/dist/index-B88j4AyE.js.map +1 -0
- package/dist/index-CY-pQbuu.cjs +2 -0
- package/dist/index-CY-pQbuu.cjs.map +1 -0
- package/dist/index.cjs +75 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2234 -51
- package/dist/index.mjs.map +1 -1
- package/dist/pattern-combiner.d.ts +1 -1
- package/dist/plugin-loader.d.ts +2 -1
- package/package.json +4 -4
- package/dist/BasePlugin-6wv0hYJ9.js +0 -98
- package/dist/BasePlugin-6wv0hYJ9.js.map +0 -1
- package/dist/BasePlugin-odQJAKA-.cjs +0 -2
- package/dist/BasePlugin-odQJAKA-.cjs.map +0 -1
- package/dist/builtin-plugins/base/BasePlugin.d.ts +0 -69
- package/dist/builtin-plugins/cpp/index.d.ts +0 -46
- package/dist/builtin-plugins/csharp/index.d.ts +0 -20
- package/dist/builtin-plugins/go/index.d.ts +0 -23
- package/dist/builtin-plugins/index.d.ts +0 -16
- package/dist/builtin-plugins/java/index.d.ts +0 -22
- package/dist/builtin-plugins/nodejs/index.d.ts +0 -44
- package/dist/builtin-plugins/php/index.d.ts +0 -20
- package/dist/builtin-plugins/python/index.d.ts +0 -27
- package/dist/builtin-plugins/ruby/index.d.ts +0 -20
- package/dist/builtin-plugins/rust/index.d.ts +0 -53
- package/dist/builtin-plugins/swift/index.d.ts +0 -22
- package/dist/default_templates/angular/angular-core.md +0 -19
- package/dist/default_templates/architecture/codeowners.md +0 -123
- package/dist/default_templates/architecture/monorepo.md +0 -146
- package/dist/default_templates/architecture/nx.md +0 -122
- package/dist/default_templates/architecture/turborepo.md +0 -114
- package/dist/default_templates/ci/github-actions.md +0 -268
- package/dist/default_templates/ci/gitlab-ci.md +0 -330
- package/dist/default_templates/containers/docker-multistage.md +0 -120
- package/dist/default_templates/containers/kubernetes-deploy.md +0 -210
- package/dist/default_templates/devops/docker-compose.md +0 -111
- package/dist/default_templates/devops/docker-dockerfile.md +0 -94
- package/dist/default_templates/devops/github-actions.md +0 -160
- package/dist/default_templates/devops/gitlab-ci.md +0 -210
- package/dist/default_templates/dotnet/framework-aspnetcore.md +0 -205
- package/dist/default_templates/dotnet/framework-blazor.md +0 -271
- package/dist/default_templates/dotnet/lang-csharp.md +0 -162
- package/dist/default_templates/generic/lang-typescript.md +0 -57
- package/dist/default_templates/generic/state-redux.md +0 -21
- package/dist/default_templates/generic/state-rxjs.md +0 -6
- package/dist/default_templates/generic/style-mui.md +0 -23
- package/dist/default_templates/generic/style-tailwind.md +0 -76
- package/dist/default_templates/generic/test-cypress.md +0 -21
- package/dist/default_templates/generic/test-jest.md +0 -20
- package/dist/default_templates/generic/test-playwright.md +0 -21
- package/dist/default_templates/generic/test-vitest.md +0 -131
- package/dist/default_templates/go/lang-go.md +0 -571
- package/dist/default_templates/java/build-gradle.md +0 -102
- package/dist/default_templates/java/build-maven.md +0 -86
- package/dist/default_templates/java/framework-spring-boot.md +0 -179
- package/dist/default_templates/java/lang-java.md +0 -78
- package/dist/default_templates/java/lang-kotlin.md +0 -88
- package/dist/default_templates/meta/magic-helix-meta.md +0 -213
- package/dist/default_templates/meta/meta-debug.md +0 -459
- package/dist/default_templates/meta/meta-implement.md +0 -450
- package/dist/default_templates/meta/meta-roadmap.md +0 -265
- package/dist/default_templates/nestjs/nestjs-core.md +0 -7
- package/dist/default_templates/patterns/architecture/clean-architecture.md +0 -469
- package/dist/default_templates/patterns/architecture/dependency-injection.md +0 -517
- package/dist/default_templates/patterns/architecture/domain-driven-design.md +0 -621
- package/dist/default_templates/patterns/architecture/layered-architecture.md +0 -382
- package/dist/default_templates/patterns/architecture/repository-pattern.md +0 -408
- package/dist/default_templates/patterns/domain-expertise/nextjs-rules.md +0 -115
- package/dist/default_templates/patterns/domain-expertise/react-patterns.md +0 -181
- package/dist/default_templates/patterns/domain-expertise/server-components.md +0 -212
- package/dist/default_templates/patterns/domain-expertise/shadcn-ui.md +0 -52
- package/dist/default_templates/patterns/domain-expertise/tailwind-patterns.md +0 -52
- package/dist/default_templates/patterns/environment/container-awareness.md +0 -17
- package/dist/default_templates/patterns/environment/ide-features.md +0 -17
- package/dist/default_templates/patterns/environment/os-commands.md +0 -17
- package/dist/default_templates/patterns/organization/heading-hierarchy.md +0 -103
- package/dist/default_templates/patterns/organization/sequential-workflows.md +0 -102
- package/dist/default_templates/patterns/organization/xml-rule-groups.md +0 -64
- package/dist/default_templates/patterns/reasoning/agent-loop.md +0 -151
- package/dist/default_templates/patterns/reasoning/confirmation-gates.md +0 -141
- package/dist/default_templates/patterns/reasoning/dependency-analysis.md +0 -132
- package/dist/default_templates/patterns/reasoning/one-tool-per-iteration.md +0 -152
- package/dist/default_templates/patterns/reasoning/preview-before-action.md +0 -194
- package/dist/default_templates/patterns/reasoning/reflection-checkpoints.md +0 -166
- package/dist/default_templates/patterns/reasoning/result-verification.md +0 -157
- package/dist/default_templates/patterns/reasoning/subtask-breakdown.md +0 -131
- package/dist/default_templates/patterns/reasoning/thinking-tags.md +0 -100
- package/dist/default_templates/patterns/role-definition/capability-declarations.md +0 -72
- package/dist/default_templates/patterns/role-definition/expert-identity.md +0 -45
- package/dist/default_templates/patterns/role-definition/scope-boundaries.md +0 -61
- package/dist/default_templates/patterns/safety/code-safety-rules.md +0 -17
- package/dist/default_templates/patterns/safety/credential-handling.md +0 -17
- package/dist/default_templates/patterns/safety/destructive-warnings.md +0 -17
- package/dist/default_templates/patterns/safety/refusal-messages.md +0 -17
- package/dist/default_templates/patterns/tone/adaptive-tone.md +0 -17
- package/dist/default_templates/patterns/tone/concise-communication.md +0 -17
- package/dist/default_templates/patterns/tone/forbidden-phrases.md +0 -17
- package/dist/default_templates/patterns/tool-guidelines/function-schemas.md +0 -143
- package/dist/default_templates/patterns/tool-guidelines/parameter-examples.md +0 -137
- package/dist/default_templates/patterns/tool-guidelines/usage-policies.md +0 -105
- package/dist/default_templates/php/framework-laravel.md +0 -112
- package/dist/default_templates/php/lang-php.md +0 -94
- package/dist/default_templates/python/lang-python.md +0 -508
- package/dist/default_templates/react/react-core.md +0 -677
- package/dist/default_templates/react/react-zustand.md +0 -7
- package/dist/default_templates/ruby/framework-rails.md +0 -309
- package/dist/default_templates/ruby/framework-sinatra.md +0 -227
- package/dist/default_templates/ruby/lang-ruby.md +0 -216
- package/dist/default_templates/rust/lang-rust.md +0 -89
- package/dist/default_templates/swift/framework-vapor.md +0 -352
- package/dist/default_templates/swift/lang-swift.md +0 -291
- package/dist/default_templates/vue/style-primevue.md +0 -6
- package/dist/default_templates/vue/style-quasar.md +0 -22
- package/dist/default_templates/vue/vue-core.md +0 -108
- package/dist/default_templates/vue/vue-pinia.md +0 -5
- package/dist/index-0GK4RlUx.js +0 -1748
- package/dist/index-0GK4RlUx.js.map +0 -1
- package/dist/index-AkVwRl-r.js +0 -92
- package/dist/index-AkVwRl-r.js.map +0 -1
- package/dist/index-B6BeG1yT.cjs +0 -68
- package/dist/index-B6BeG1yT.cjs.map +0 -1
- package/dist/index-B8pyjKdF.js +0 -94
- package/dist/index-B8pyjKdF.js.map +0 -1
- package/dist/index-BQ6v041y.js +0 -13
- package/dist/index-BQ6v041y.js.map +0 -1
- package/dist/index-Baxb1vI_.js +0 -210
- package/dist/index-Baxb1vI_.js.map +0 -1
- package/dist/index-Bg8DD8ku.js +0 -216
- package/dist/index-Bg8DD8ku.js.map +0 -1
- package/dist/index-BqTqxCpG.cjs +0 -89
- package/dist/index-BqTqxCpG.cjs.map +0 -1
- package/dist/index-Bv4Q1Pr7.cjs +0 -33
- package/dist/index-Bv4Q1Pr7.cjs.map +0 -1
- package/dist/index-CN8J45Nc.cjs +0 -24
- package/dist/index-CN8J45Nc.cjs.map +0 -1
- package/dist/index-CPbv2Od1.js +0 -62
- package/dist/index-CPbv2Od1.js.map +0 -1
- package/dist/index-Cf-MC6Al.js +0 -63
- package/dist/index-Cf-MC6Al.js.map +0 -1
- package/dist/index-DDPXXXDy.cjs +0 -19
- package/dist/index-DDPXXXDy.cjs.map +0 -1
- package/dist/index-DO30AzDe.cjs +0 -19
- package/dist/index-DO30AzDe.cjs.map +0 -1
- package/dist/index-DkvW5yBY.js +0 -2249
- package/dist/index-DkvW5yBY.js.map +0 -1
- package/dist/index-Dn1ehjIj.cjs +0 -80
- package/dist/index-Dn1ehjIj.cjs.map +0 -1
- package/dist/index-DqHvgoXJ.cjs +0 -19
- package/dist/index-DqHvgoXJ.cjs.map +0 -1
- package/dist/index-K39pdw94.cjs +0 -31
- package/dist/index-K39pdw94.cjs.map +0 -1
- package/dist/index-OT2XAJkc.js +0 -117
- package/dist/index-OT2XAJkc.js.map +0 -1
- package/dist/index-TPAX4XKg.cjs +0 -30
- package/dist/index-TPAX4XKg.cjs.map +0 -1
- package/dist/index-WmVSB57y.js +0 -107
- package/dist/index-WmVSB57y.js.map +0 -1
- package/dist/index-mYXvc3Fs.js +0 -68
- package/dist/index-mYXvc3Fs.js.map +0 -1
- package/dist/index-nioXOg4m.cjs +0 -76
- package/dist/index-nioXOg4m.cjs.map +0 -1
- package/dist/index-okhY3fWD.cjs +0 -2
- package/dist/index-okhY3fWD.cjs.map +0 -1
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Agent Loop Pattern
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Define iterative execution cycle for autonomous agents. From **Manus** pattern.
|
|
5
|
-
|
|
6
|
-
## Template
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
## Agent Execution Loop
|
|
10
|
-
|
|
11
|
-
Repeat the following cycle until goal is achieved:
|
|
12
|
-
|
|
13
|
-
### 1. Observe
|
|
14
|
-
- Read current state: {WHAT_TO_CHECK}
|
|
15
|
-
- Identify changes: {WHAT_CHANGED_SINCE_LAST_ITERATION}
|
|
16
|
-
- Note user input: {NEW_REQUIREMENTS_OR_FEEDBACK}
|
|
17
|
-
|
|
18
|
-
### 2. Orient
|
|
19
|
-
- Assess progress: {HOW_CLOSE_TO_GOAL}
|
|
20
|
-
- Identify blockers: {WHAT_IS_PREVENTING_COMPLETION}
|
|
21
|
-
- Update plan: {ADJUST_STRATEGY_IF_NEEDED}
|
|
22
|
-
|
|
23
|
-
### 3. Decide
|
|
24
|
-
- Select next action: {WHICH_TOOL_OR_OPERATION}
|
|
25
|
-
- Validate feasibility: {CAN_THIS_ACTION_SUCCEED}
|
|
26
|
-
- Prepare parameters: {GATHER_REQUIRED_INPUTS}
|
|
27
|
-
|
|
28
|
-
### 4. Act
|
|
29
|
-
- Execute selected action: {CALL_TOOL_OR_PERFORM_OPERATION}
|
|
30
|
-
- Capture results: {STORE_OUTPUT_FOR_NEXT_ITERATION}
|
|
31
|
-
- Handle errors: {RETRY_OR_FALLBACK_IF_FAILED}
|
|
32
|
-
|
|
33
|
-
### 5. Reflect
|
|
34
|
-
- Evaluate outcome: {DID_ACTION_ACHIEVE_INTENDED_EFFECT}
|
|
35
|
-
- Learn from result: {UPDATE_KNOWLEDGE_OR_ASSUMPTIONS}
|
|
36
|
-
- Decide continuation: {REPEAT_LOOP_OR_TERMINATE}
|
|
37
|
-
|
|
38
|
-
**Termination Conditions**:
|
|
39
|
-
- Goal achieved: {SUCCESS_CRITERIA_MET}
|
|
40
|
-
- Unrecoverable error: {CANNOT_PROCEED_FURTHER}
|
|
41
|
-
- Max iterations reached: {SAFETY_LIMIT_HIT}
|
|
42
|
-
- User interruption: {USER_REQUESTED_STOP}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Examples
|
|
46
|
-
|
|
47
|
-
### Manus (Code Debugging Loop)
|
|
48
|
-
```markdown
|
|
49
|
-
## Agent Execution Loop: Debug and Fix Error
|
|
50
|
-
|
|
51
|
-
Repeat the following cycle until error is resolved:
|
|
52
|
-
|
|
53
|
-
### 1. Observe
|
|
54
|
-
- Read current state: Error message, stack trace, failed test output
|
|
55
|
-
- Identify changes: What code was just modified?
|
|
56
|
-
- Note user input: Any hints or context provided?
|
|
57
|
-
|
|
58
|
-
### 2. Orient
|
|
59
|
-
- Assess progress: Is error message clearer than before?
|
|
60
|
-
- Identify blockers: Missing dependencies? Syntax errors? Logic bugs?
|
|
61
|
-
- Update plan: Do we need to install packages, fix imports, or rewrite logic?
|
|
62
|
-
|
|
63
|
-
### 3. Decide
|
|
64
|
-
- Select next action: Read error source file, check imports, run tests
|
|
65
|
-
- Validate feasibility: Do we have file path? Are tools available?
|
|
66
|
-
- Prepare parameters: File path, line numbers, test command
|
|
67
|
-
|
|
68
|
-
### 4. Act
|
|
69
|
-
- Execute selected action: `read_file(errorFile, errorLine-5, errorLine+5)`
|
|
70
|
-
- Capture results: Store file contents, understand context
|
|
71
|
-
- Handle errors: If file not found, search for similar files
|
|
72
|
-
|
|
73
|
-
### 5. Reflect
|
|
74
|
-
- Evaluate outcome: Does file content reveal the issue?
|
|
75
|
-
- Learn from result: Update mental model of codebase
|
|
76
|
-
- Decide continuation: If root cause found, apply fix; else investigate deeper
|
|
77
|
-
|
|
78
|
-
**Termination Conditions**:
|
|
79
|
-
- Goal achieved: Tests pass, error no longer occurs
|
|
80
|
-
- Unrecoverable error: Required file deleted, system-level issue
|
|
81
|
-
- Max iterations reached: 10 loops without progress (escalate to user)
|
|
82
|
-
- User interruption: User provides new direction or cancels
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### same.new (Feature Implementation Loop)
|
|
86
|
-
```markdown
|
|
87
|
-
## Agent Execution Loop: Build Feature
|
|
88
|
-
|
|
89
|
-
Repeat the following cycle until feature is complete:
|
|
90
|
-
|
|
91
|
-
### 1. Observe
|
|
92
|
-
- Read current state: Existing components, dependencies, file structure
|
|
93
|
-
- Identify changes: What was just created/modified?
|
|
94
|
-
- Note user input: Feature requirements, design preferences
|
|
95
|
-
|
|
96
|
-
### 2. Orient
|
|
97
|
-
- Assess progress: Which components are done? What's remaining?
|
|
98
|
-
- Identify blockers: Missing libraries? Unclear requirements?
|
|
99
|
-
- Update plan: Break feature into smaller components if needed
|
|
100
|
-
|
|
101
|
-
### 3. Decide
|
|
102
|
-
- Select next action: Create component, install package, write test
|
|
103
|
-
- Validate feasibility: Do we have design? Dependencies available?
|
|
104
|
-
- Prepare parameters: Component name, props, styling approach
|
|
105
|
-
|
|
106
|
-
### 4. Act
|
|
107
|
-
- Execute selected action: `create_file(ComponentName.tsx, content)`
|
|
108
|
-
- Capture results: Store component path for imports
|
|
109
|
-
- Handle errors: If file exists, modify instead of create
|
|
110
|
-
|
|
111
|
-
### 5. Reflect
|
|
112
|
-
- Evaluate outcome: Does component match requirements?
|
|
113
|
-
- Learn from result: Note patterns for similar components
|
|
114
|
-
- Decide continuation: If feature incomplete, build next piece; else finalize
|
|
115
|
-
|
|
116
|
-
**Termination Conditions**:
|
|
117
|
-
- Goal achieved: Feature works, tests pass, user approves
|
|
118
|
-
- Unrecoverable error: Conflicting requirements, impossible constraints
|
|
119
|
-
- Max iterations reached: 20 loops (feature too complex, break down further)
|
|
120
|
-
- User interruption: User requests changes or different feature
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Variables
|
|
124
|
-
- `{WHAT_TO_CHECK}`: State to examine each iteration
|
|
125
|
-
- `{WHAT_CHANGED_SINCE_LAST_ITERATION}`: Delta from previous cycle
|
|
126
|
-
- `{NEW_REQUIREMENTS_OR_FEEDBACK}`: User input to incorporate
|
|
127
|
-
- `{HOW_CLOSE_TO_GOAL}`: Progress measurement
|
|
128
|
-
- `{WHAT_IS_PREVENTING_COMPLETION}`: Blockers/dependencies
|
|
129
|
-
- `{ADJUST_STRATEGY_IF_NEEDED}`: Plan modifications
|
|
130
|
-
- `{WHICH_TOOL_OR_OPERATION}`: Next action to take
|
|
131
|
-
- `{CAN_THIS_ACTION_SUCCEED}`: Feasibility check
|
|
132
|
-
- `{GATHER_REQUIRED_INPUTS}`: Parameter preparation
|
|
133
|
-
- `{CALL_TOOL_OR_PERFORM_OPERATION}`: Execution step
|
|
134
|
-
- `{STORE_OUTPUT_FOR_NEXT_ITERATION}`: Result capture
|
|
135
|
-
- `{RETRY_OR_FALLBACK_IF_FAILED}`: Error handling
|
|
136
|
-
- `{DID_ACTION_ACHIEVE_INTENDED_EFFECT}`: Outcome evaluation
|
|
137
|
-
- `{UPDATE_KNOWLEDGE_OR_ASSUMPTIONS}`: Learning
|
|
138
|
-
- `{REPEAT_LOOP_OR_TERMINATE}`: Continuation decision
|
|
139
|
-
- `{SUCCESS_CRITERIA_MET}`: Goal achieved condition
|
|
140
|
-
- `{CANNOT_PROCEED_FURTHER}`: Unrecoverable error condition
|
|
141
|
-
- `{SAFETY_LIMIT_HIT}`: Max iterations condition
|
|
142
|
-
- `{USER_REQUESTED_STOP}`: User interruption condition
|
|
143
|
-
|
|
144
|
-
## Best Practices
|
|
145
|
-
1. Use OODA framework (Observe, Orient, Decide, Act) + Reflect
|
|
146
|
-
2. One tool call per iteration (no parallel in loop)
|
|
147
|
-
3. State termination conditions explicitly
|
|
148
|
-
4. Include safety limit (max iterations)
|
|
149
|
-
5. Capture learnings between iterations
|
|
150
|
-
6. Allow user interruption at any point
|
|
151
|
-
7. Benefits: Autonomous operation, adaptability, progress tracking, safety bounds
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# Confirmation Gates Pattern
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Require user approval before destructive or high-impact operations. From **same.new** and **Cline** patterns.
|
|
5
|
-
|
|
6
|
-
## Template
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
## Confirmation Gates
|
|
10
|
-
|
|
11
|
-
Before executing {OPERATION_TYPE}, show preview and wait for approval:
|
|
12
|
-
|
|
13
|
-
### Operations Requiring Confirmation
|
|
14
|
-
- **File Deletion**: {LIST_FILES_TO_DELETE}
|
|
15
|
-
- **Overwrite**: {SHOW_DIFF_OLD_VS_NEW}
|
|
16
|
-
- **Bulk Changes**: {SUMMARIZE_SCOPE_AND_IMPACT}
|
|
17
|
-
- **Destructive Commands**: {EXPLAIN_WHAT_WILL_BE_LOST}
|
|
18
|
-
|
|
19
|
-
### Confirmation Format
|
|
20
|
-
```
|
|
21
|
-
⚠️ **Confirmation Required**
|
|
22
|
-
|
|
23
|
-
**Operation**: {OPERATION_NAME}
|
|
24
|
-
**Impact**: {WHAT_WILL_CHANGE}
|
|
25
|
-
**Files Affected**: {COUNT_AND_LIST}
|
|
26
|
-
|
|
27
|
-
**Preview**:
|
|
28
|
-
{SHOW_BEFORE_AFTER_OR_DIFF}
|
|
29
|
-
|
|
30
|
-
Proceed? (yes/no)
|
|
31
|
-
```
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
### same.new (File Overwrite)
|
|
37
|
-
```markdown
|
|
38
|
-
## Confirmation Gates: File Operations
|
|
39
|
-
|
|
40
|
-
Before overwriting existing files, show diff and wait for approval:
|
|
41
|
-
|
|
42
|
-
⚠️ **Confirmation Required**
|
|
43
|
-
|
|
44
|
-
**Operation**: Overwrite `src/components/Button.tsx`
|
|
45
|
-
**Impact**: Existing component will be replaced
|
|
46
|
-
**Files Affected**: 1 file
|
|
47
|
-
|
|
48
|
-
**Preview (diff)**:
|
|
49
|
-
```diff
|
|
50
|
-
- export const Button = ({ label }: ButtonProps) => {
|
|
51
|
-
- return <button className="btn">{label}</button>;
|
|
52
|
-
+ export const Button = ({ children, variant = 'primary' }: ButtonProps) => {
|
|
53
|
-
+ return <button className={`btn btn-${variant}`}>{children}</button>;
|
|
54
|
-
};
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Risk Assessment**:
|
|
58
|
-
- ✅ TypeScript types will catch breaking changes
|
|
59
|
-
- ⚠️ Existing usages with `label` prop will need updates
|
|
60
|
-
- ℹ️ Found 8 files importing this component
|
|
61
|
-
|
|
62
|
-
Proceed? (yes/no)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Cline (Bulk Deletion)
|
|
66
|
-
```markdown
|
|
67
|
-
## Confirmation Gates: Destructive Operations
|
|
68
|
-
|
|
69
|
-
Before deleting multiple files, show impact and wait for approval:
|
|
70
|
-
|
|
71
|
-
⚠️ **Confirmation Required**
|
|
72
|
-
|
|
73
|
-
**Operation**: Delete unused test fixtures
|
|
74
|
-
**Impact**: 12 files will be permanently deleted
|
|
75
|
-
**Files Affected**:
|
|
76
|
-
- tests/fixtures/user-data.json
|
|
77
|
-
- tests/fixtures/product-catalog.json
|
|
78
|
-
- tests/fixtures/old-api-response.json
|
|
79
|
-
- ... (9 more files)
|
|
80
|
-
|
|
81
|
-
**Risk Assessment**:
|
|
82
|
-
- ⚠️ **WARNING**: This cannot be undone unless files are in git
|
|
83
|
-
- ✅ Git status: All files committed (can recover from history)
|
|
84
|
-
- ℹ️ These files are not referenced in any test files
|
|
85
|
-
|
|
86
|
-
**Recommended Action**: Review list carefully before confirming
|
|
87
|
-
|
|
88
|
-
Proceed? (yes/no)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### ChatGPT (Credential Exposure)
|
|
92
|
-
```markdown
|
|
93
|
-
## Confirmation Gates: Security Risk
|
|
94
|
-
|
|
95
|
-
Before generating code with sensitive data, warn and request confirmation:
|
|
96
|
-
|
|
97
|
-
⚠️ **Confirmation Required**
|
|
98
|
-
|
|
99
|
-
**Operation**: Generate API client with authentication
|
|
100
|
-
**Impact**: Code will include authentication logic
|
|
101
|
-
**Security Risk**: HIGH
|
|
102
|
-
|
|
103
|
-
**Warning**:
|
|
104
|
-
- ❌ NEVER hardcode API keys in code
|
|
105
|
-
- ❌ NEVER commit credentials to git
|
|
106
|
-
- ✅ Use environment variables (.env file)
|
|
107
|
-
- ✅ Add .env to .gitignore
|
|
108
|
-
|
|
109
|
-
**Proposed Implementation**:
|
|
110
|
-
```typescript
|
|
111
|
-
const apiKey = process.env.API_KEY; // ✅ From environment
|
|
112
|
-
// NOT: const apiKey = 'sk-abc123...'; // ❌ Hardcoded
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
I will generate code using environment variables. Proceed? (yes/no)
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Variables
|
|
119
|
-
- `{OPERATION_TYPE}`: Category of operation (delete, overwrite, bulk edit)
|
|
120
|
-
- `{LIST_FILES_TO_DELETE}`: Affected file paths
|
|
121
|
-
- `{SHOW_DIFF_OLD_VS_NEW}`: Side-by-side or unified diff
|
|
122
|
-
- `{SUMMARIZE_SCOPE_AND_IMPACT}`: How many files, what changes
|
|
123
|
-
- `{EXPLAIN_WHAT_WILL_BE_LOST}`: Data that can't be recovered
|
|
124
|
-
- `{OPERATION_NAME}`: Specific action (e.g., "Delete 12 test fixtures")
|
|
125
|
-
- `{WHAT_WILL_CHANGE}`: User-facing description
|
|
126
|
-
- `{COUNT_AND_LIST}`: Number and paths
|
|
127
|
-
- `{SHOW_BEFORE_AFTER_OR_DIFF}`: Visual comparison
|
|
128
|
-
|
|
129
|
-
## Best Practices
|
|
130
|
-
1. Always show confirmation for:
|
|
131
|
-
- File/directory deletion
|
|
132
|
-
- Overwriting existing files (unless explicitly replacing)
|
|
133
|
-
- Running commands with sudo/admin privileges
|
|
134
|
-
- Exposing credentials or secrets
|
|
135
|
-
- Bulk operations (>5 files)
|
|
136
|
-
2. Include risk assessment (✅ safe, ⚠️ warning, ❌ danger)
|
|
137
|
-
3. Explain what can't be undone vs. what's recoverable
|
|
138
|
-
4. Show concrete preview (diff, file list, command output)
|
|
139
|
-
5. Suggest safer alternatives when applicable
|
|
140
|
-
6. Wait for explicit "yes" (don't proceed on silence)
|
|
141
|
-
7. Benefits: Prevents accidents, builds trust, surfaces unintended consequences
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Dependency Analysis Pattern
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Identify prerequisites, conflicts, and ordering constraints. From **Bolt.new** and **same.new** patterns.
|
|
5
|
-
|
|
6
|
-
## Template
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
## Dependency Analysis
|
|
10
|
-
|
|
11
|
-
### Direct Dependencies
|
|
12
|
-
- {COMPONENT_A} requires {COMPONENT_B}
|
|
13
|
-
- {COMPONENT_C} requires {COMPONENT_D}
|
|
14
|
-
|
|
15
|
-
### Transitive Dependencies
|
|
16
|
-
- {COMPONENT_A} → {COMPONENT_B} → {COMPONENT_E}
|
|
17
|
-
|
|
18
|
-
### Conflicts
|
|
19
|
-
- {PACKAGE_X} v{VERSION_1} conflicts with {PACKAGE_Y} v{VERSION_2}
|
|
20
|
-
- Resolution: {HOW_TO_RESOLVE}
|
|
21
|
-
|
|
22
|
-
### Execution Order
|
|
23
|
-
```mermaid
|
|
24
|
-
graph TD
|
|
25
|
-
A[{TASK_A}] --> B[{TASK_B}]
|
|
26
|
-
A --> C[{TASK_C}]
|
|
27
|
-
B --> D[{TASK_D}]
|
|
28
|
-
C --> D
|
|
29
|
-
```
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Examples
|
|
33
|
-
|
|
34
|
-
### Bolt.new (Package Dependencies)
|
|
35
|
-
```markdown
|
|
36
|
-
## Dependency Analysis: Adding Prisma ORM
|
|
37
|
-
|
|
38
|
-
### Direct Dependencies
|
|
39
|
-
- Prisma Client requires `@prisma/client` package
|
|
40
|
-
- Prisma CLI requires `prisma` as dev dependency
|
|
41
|
-
- Database adapter requires PostgreSQL client
|
|
42
|
-
|
|
43
|
-
### Transitive Dependencies
|
|
44
|
-
- `@prisma/client` → database driver (pg, mysql2, etc.)
|
|
45
|
-
- Prisma CLI → Node.js runtime (>= 16.13.0)
|
|
46
|
-
- Database migrations → existing database connection
|
|
47
|
-
|
|
48
|
-
### Conflicts
|
|
49
|
-
- `@prisma/client` v5.x conflicts with Next.js v12 (uses CommonJS)
|
|
50
|
-
- Resolution: Upgrade to Next.js v13+ (supports ESM) or use Prisma v4.x
|
|
51
|
-
|
|
52
|
-
### Installation Order
|
|
53
|
-
1. Install Prisma CLI (`npm i -D prisma`)
|
|
54
|
-
2. Initialize Prisma (`npx prisma init`)
|
|
55
|
-
3. Define schema (`schema.prisma`)
|
|
56
|
-
4. Run migrations (`npx prisma migrate dev`)
|
|
57
|
-
5. Install client (`npm i @prisma/client`)
|
|
58
|
-
6. Generate client (`npx prisma generate`)
|
|
59
|
-
|
|
60
|
-
### Why This Order?
|
|
61
|
-
- CLI needed before `init` command
|
|
62
|
-
- Schema must exist before migrations
|
|
63
|
-
- Migrations create database tables
|
|
64
|
-
- Client generated from schema
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### same.new (Component Dependencies)
|
|
68
|
-
```markdown
|
|
69
|
-
## Dependency Analysis: Building Dashboard Layout
|
|
70
|
-
|
|
71
|
-
### Direct Dependencies
|
|
72
|
-
- `Dashboard` requires `Sidebar` component
|
|
73
|
-
- `Dashboard` requires `TopNav` component
|
|
74
|
-
- `Sidebar` requires `NavLink` component
|
|
75
|
-
- `TopNav` requires `UserMenu` component
|
|
76
|
-
|
|
77
|
-
### Transitive Dependencies
|
|
78
|
-
- `Dashboard` → `Sidebar` → `NavLink` → `Icon` component
|
|
79
|
-
- `Dashboard` → `TopNav` → `UserMenu` → `Avatar` component
|
|
80
|
-
- All components → `ThemeProvider` context
|
|
81
|
-
|
|
82
|
-
### Conflicts
|
|
83
|
-
- `Sidebar` uses fixed positioning (overlaps main content on mobile)
|
|
84
|
-
- `TopNav` uses sticky positioning (z-index conflict with modals)
|
|
85
|
-
- Resolution: Establish z-index scale (nav: 100, sidebar: 200, modal: 1000)
|
|
86
|
-
|
|
87
|
-
### Build Order
|
|
88
|
-
```mermaid
|
|
89
|
-
graph TD
|
|
90
|
-
A[Icon] --> B[NavLink]
|
|
91
|
-
C[Avatar] --> D[UserMenu]
|
|
92
|
-
B --> E[Sidebar]
|
|
93
|
-
D --> F[TopNav]
|
|
94
|
-
E --> G[Dashboard]
|
|
95
|
-
F --> G
|
|
96
|
-
H[ThemeProvider] --> G
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
1. Build leaf components (`Icon`, `Avatar`)
|
|
100
|
-
2. Build composed components (`NavLink`, `UserMenu`)
|
|
101
|
-
3. Build layout sections (`Sidebar`, `TopNav`)
|
|
102
|
-
4. Build container (`Dashboard`)
|
|
103
|
-
5. Wrap in `ThemeProvider`
|
|
104
|
-
|
|
105
|
-
### Why This Order?
|
|
106
|
-
- Leaf components have no dependencies (can build first)
|
|
107
|
-
- Composed components need leaf components (build after)
|
|
108
|
-
- Layout sections need composed components (build after)
|
|
109
|
-
- Container orchestrates sections (build last)
|
|
110
|
-
- Provider wraps everything (applied at root)
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Variables
|
|
114
|
-
- `{COMPONENT_X}`: Module, package, or component
|
|
115
|
-
- `{VERSION_X}`: Specific version number
|
|
116
|
-
- `{TASK_X}`: Operation or build step
|
|
117
|
-
- `{HOW_TO_RESOLVE}`: Conflict resolution strategy
|
|
118
|
-
|
|
119
|
-
## Best Practices
|
|
120
|
-
1. Distinguish direct vs transitive dependencies
|
|
121
|
-
2. Identify circular dependencies early (impossible to resolve)
|
|
122
|
-
3. Document version constraints (>=, ^, ~)
|
|
123
|
-
4. Explain *why* order matters (not just *what* order)
|
|
124
|
-
5. Visualize complex dependency graphs (Mermaid, ASCII)
|
|
125
|
-
6. Plan for missing dependencies (install, create, mock)
|
|
126
|
-
7. Benefits: Prevents build failures, enables parallel work, surfaces conflicts early
|
|
127
|
-
|
|
128
|
-
## Implementation Notes
|
|
129
|
-
- Run dependency analysis before starting multi-component builds
|
|
130
|
-
- Update analysis when adding new dependencies
|
|
131
|
-
- Use package manager output to verify constraints (`npm ls`, `pnpm why`)
|
|
132
|
-
- Check for peer dependency warnings (often indicate conflicts)
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# One Tool Per Iteration Pattern
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Enforce sequential tool usage to maintain state consistency. From **Manus** and **Cline** patterns.
|
|
5
|
-
|
|
6
|
-
## Template
|
|
7
|
-
|
|
8
|
-
```markdown
|
|
9
|
-
## Tool Execution Policy
|
|
10
|
-
|
|
11
|
-
Execute tools sequentially, one per iteration:
|
|
12
|
-
|
|
13
|
-
1. **Select One Tool**: Choose single tool based on current state
|
|
14
|
-
2. **Gather Parameters**: Collect all required inputs for that tool
|
|
15
|
-
3. **Execute**: Call the tool and wait for completion
|
|
16
|
-
4. **Process Results**: Analyze output before next action
|
|
17
|
-
5. **Repeat**: Select next tool based on new state
|
|
18
|
-
|
|
19
|
-
**Never**:
|
|
20
|
-
- Call multiple tools in parallel within the agent loop
|
|
21
|
-
- Assume tool output without checking
|
|
22
|
-
- Chain tools without validating intermediate results
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Examples
|
|
26
|
-
|
|
27
|
-
### Manus (File Analysis)
|
|
28
|
-
```markdown
|
|
29
|
-
## Tool Execution Policy: Analyze Codebase
|
|
30
|
-
|
|
31
|
-
Execute tools sequentially, one per iteration:
|
|
32
|
-
|
|
33
|
-
**Iteration 1**: Search for files
|
|
34
|
-
```
|
|
35
|
-
tool: file_search
|
|
36
|
-
params: { pattern: "**/*.ts" }
|
|
37
|
-
result: [src/app.ts, src/utils.ts, src/config.ts]
|
|
38
|
-
next_action: Read first file
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Iteration 2**: Read primary file
|
|
42
|
-
```
|
|
43
|
-
tool: read_file
|
|
44
|
-
params: { path: "src/app.ts", startLine: 1, endLine: 100 }
|
|
45
|
-
result: Contains import from "./utils"
|
|
46
|
-
next_action: Read dependency
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Iteration 3**: Read dependency file
|
|
50
|
-
```
|
|
51
|
-
tool: read_file
|
|
52
|
-
params: { path: "src/utils.ts", startLine: 1, endLine: 50 }
|
|
53
|
-
result: Contains helper functions
|
|
54
|
-
next_action: Analyze config
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Why Sequential?**
|
|
58
|
-
- Iteration 2 revealed dependency on utils.ts (couldn't predict before iteration 1)
|
|
59
|
-
- Iteration 3 needed based on imports found in iteration 2
|
|
60
|
-
- Parallel calls would miss these dependencies
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Cline (Debugging Workflow)
|
|
64
|
-
```markdown
|
|
65
|
-
## Tool Execution Policy: Fix Runtime Error
|
|
66
|
-
|
|
67
|
-
Execute tools sequentially, one per iteration:
|
|
68
|
-
|
|
69
|
-
**Iteration 1**: Search for error in logs
|
|
70
|
-
```
|
|
71
|
-
tool: grep_search
|
|
72
|
-
params: { query: "Error: Module not found", isRegexp: false }
|
|
73
|
-
result: Found in src/components/Header.tsx line 5
|
|
74
|
-
next_action: Read file with error
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Iteration 2**: Read file containing error
|
|
78
|
-
```
|
|
79
|
-
tool: read_file
|
|
80
|
-
params: { path: "src/components/Header.tsx", startLine: 1, endLine: 20 }
|
|
81
|
-
result: import { Button } from '@/components/ui/button'
|
|
82
|
-
next_action: Check if file exists
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Iteration 3**: Verify imported file exists
|
|
86
|
-
```
|
|
87
|
-
tool: file_search
|
|
88
|
-
params: { pattern: "**/ui/button.*" }
|
|
89
|
-
result: src/components/ui/Button.tsx (capital B!)
|
|
90
|
-
next_action: Fix import path
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Iteration 4**: Correct the import
|
|
94
|
-
```
|
|
95
|
-
tool: replace_string_in_file
|
|
96
|
-
params: {
|
|
97
|
-
path: "src/components/Header.tsx",
|
|
98
|
-
oldString: "from '@/components/ui/button'",
|
|
99
|
-
newString: "from '@/components/ui/Button'"
|
|
100
|
-
}
|
|
101
|
-
result: File updated successfully
|
|
102
|
-
next_action: Verify build passes
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Why Sequential?**
|
|
106
|
-
- Couldn't identify file path until grep found it (iteration 1)
|
|
107
|
-
- Couldn't determine fix until seeing actual import (iteration 2)
|
|
108
|
-
- Couldn't know correct path until searching filesystem (iteration 3)
|
|
109
|
-
- Each step informed the next action
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## When to Break This Rule
|
|
113
|
-
|
|
114
|
-
### Parallel Reads (Cline Exception)
|
|
115
|
-
```markdown
|
|
116
|
-
**Allowed**: Reading multiple independent files
|
|
117
|
-
```
|
|
118
|
-
tools: [
|
|
119
|
-
read_file({ path: "src/app.ts", startLine: 1, endLine: 50 }),
|
|
120
|
-
read_file({ path: "src/config.ts", startLine: 1, endLine: 30 }),
|
|
121
|
-
read_file({ path: "tests/app.test.ts", startLine: 1, endLine: 40 })
|
|
122
|
-
]
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Why Allowed?**
|
|
126
|
-
- Files are known to exist (from previous search)
|
|
127
|
-
- No dependencies between reads
|
|
128
|
-
- Just gathering context, not modifying state
|
|
129
|
-
- Significantly faster than 3 sequential iterations
|
|
130
|
-
|
|
131
|
-
**Not Allowed**: Reading files discovered during search
|
|
132
|
-
- Risk: Files might not exist or might not contain expected content
|
|
133
|
-
- Better: Read first file, validate, then read others if needed
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Variables
|
|
137
|
-
- N/A (this is a process pattern, not a template)
|
|
138
|
-
|
|
139
|
-
## Best Practices
|
|
140
|
-
1. One tool call per iteration in agent loops
|
|
141
|
-
2. Validate tool output before next call
|
|
142
|
-
3. Exception: Parallel reads when files are pre-validated
|
|
143
|
-
4. Never parallelize: writes, terminal commands, state-changing operations
|
|
144
|
-
5. Use tool output to inform next tool selection
|
|
145
|
-
6. Document why each tool was chosen (reasoning chain)
|
|
146
|
-
7. Benefits: Predictable state, easier debugging, adaptive execution
|
|
147
|
-
|
|
148
|
-
## Implementation Notes
|
|
149
|
-
- Most models naturally follow this pattern
|
|
150
|
-
- Explicitly state in system prompt to prevent parallel tool abuse
|
|
151
|
-
- Useful for autonomous agents (Manus, Cline, Augment)
|
|
152
|
-
- Less critical for user-directed agents (v0, same.new) where user provides guidance between steps
|