bobs-workshop 3.1.1 β†’ 3.1.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.
@@ -12,23 +12,23 @@ metadata:
12
12
 
13
13
  ---
14
14
 
15
- ## πŸ›‘ SOCRATIC GATE (ENFORCEMENT)
15
+ ## STOP SOCRATIC GATE (ENFORCEMENT)
16
16
 
17
17
  ### When to Trigger
18
18
 
19
19
  | Pattern | Action |
20
20
  |---------|--------|
21
- | "Build/Create/Make [thing]" without details | πŸ›‘ ASK 3 questions |
22
- | Complex feature or architecture | πŸ›‘ Clarify before implementing |
23
- | Update/change request | πŸ›‘ Confirm scope |
24
- | Vague requirements | πŸ›‘ Ask purpose, users, constraints |
21
+ | "Build/Create/Make [thing]" without details | STOP ASK 3 questions |
22
+ | Complex feature or architecture | STOP Clarify before implementing |
23
+ | Update/change request | STOP Confirm scope |
24
+ | Vague requirements | STOP Ask purpose, users, constraints |
25
25
 
26
- ### 🚫 MANDATORY: 3 Questions Before Implementation
26
+ ### DENIED MANDATORY: 3 Questions Before Implementation
27
27
 
28
28
  1. **STOP** - Do NOT start coding
29
29
  2. **ASK** - Minimum 3 questions:
30
- - 🎯 Purpose: What problem are you solving?
31
- - πŸ‘₯ Users: Who will use this?
30
+ - [TARGET] Purpose: What problem are you solving?
31
+ - [TEAM] Users: Who will use this?
32
32
  - πŸ“¦ Scope: Must-have vs nice-to-have?
33
33
  3. **WAIT** - Get response before proceeding
34
34
 
@@ -36,7 +36,7 @@ metadata:
36
36
 
37
37
  ## 🧠 Dynamic Question Generation
38
38
 
39
- **β›” NEVER use static templates.** Read `dynamic-questioning.md` for principles.
39
+ **BLOCKED NEVER use static templates.** Read `dynamic-questioning.md` for principles.
40
40
 
41
41
  ### Core Principles
42
42
 
@@ -85,17 +85,17 @@ metadata:
85
85
 
86
86
  | Agent | Status | Current Task | Progress |
87
87
  |-------|--------|--------------|----------|
88
- | [Agent Name] | βœ…πŸ”„β³βŒβš οΈ | [Task description] | [% or count] |
88
+ | [Agent Name] | YES[REFRESH]⏳NOWARNING | [Task description] | [% or count] |
89
89
 
90
90
  ### Status Icons
91
91
 
92
92
  | Icon | Meaning | Usage |
93
93
  |------|---------|-------|
94
- | βœ… | Completed | Task finished successfully |
95
- | πŸ”„ | Running | Currently executing |
94
+ | YES | Completed | Task finished successfully |
95
+ | [REFRESH] | Running | Currently executing |
96
96
  | ⏳ | Waiting | Blocked, waiting for dependency |
97
- | ❌ | Error | Failed, needs attention |
98
- | ⚠️ | Warning | Potential issue, not blocking |
97
+ | NO | Error | Failed, needs attention |
98
+ | WARNING | Warning | Potential issue, not blocking |
99
99
 
100
100
  ---
101
101
 
@@ -143,7 +143,7 @@ metadata:
143
143
  | Principle | Implementation |
144
144
  |-----------|----------------|
145
145
  | **Concise** | No unnecessary details, get to point |
146
- | **Visual** | Use emojis (βœ…πŸ”„β³βŒ) for quick scanning |
146
+ | **Visual** | Use emojis (YES[REFRESH]⏳NO) for quick scanning |
147
147
  | **Specific** | "~2 minutes" not "wait a bit" |
148
148
  | **Alternatives** | Offer multiple paths when stuck |
149
149
  | **Proactive** | Suggest next step after completion |
@@ -170,7 +170,7 @@ This skill is used by **alice (architect)** agent during the PLAN phase.
170
170
 
171
171
  Add planning section to MANUAL:
172
172
  ```markdown
173
- ## πŸ“ Product Specifications
173
+ ## [DOC] Product Specifications
174
174
 
175
175
  ### Requirements Clarification (Socratic Gate)
176
176
  - [ ] Purpose identified
@@ -190,7 +190,7 @@ Update agent handoffs with status:
190
190
  ```markdown
191
191
  ## 🀝 Agent Handoffs
192
192
 
193
- πŸ”„ alice: Planning in progress (3/5 tasks complete)
193
+ [REFRESH] alice: Planning in progress (3/5 tasks complete)
194
194
  🀝 alice β†’ bob-eng: Handoff - MANUAL ready for implementation
195
195
  ```
196
196
 
@@ -198,7 +198,7 @@ Update agent handoffs with status:
198
198
 
199
199
  Standardize error messages across all agents:
200
200
  ```markdown
201
- ❌ Error: [Brief description]
201
+ NO Error: [Brief description]
202
202
 
203
203
  **What happened:** [User-friendly explanation]
204
204
 
@@ -72,7 +72,7 @@ metadata:
72
72
 
73
73
  ## Anti-Patterns (DON'T)
74
74
 
75
- | ❌ Pattern | βœ… Fix |
75
+ | NO Pattern | YES Fix |
76
76
  |-----------|-------|
77
77
  | Comment every line | Delete obvious comments |
78
78
  | Helper for one-liner | Inline the code |
@@ -85,7 +85,7 @@ metadata:
85
85
 
86
86
  ---
87
87
 
88
- ## πŸ”΄ Before Editing ANY File (THINK FIRST!)
88
+ ## CRITICAL Before Editing ANY File (THINK FIRST!)
89
89
 
90
90
  **Before changing a file, ask yourself:**
91
91
 
@@ -103,8 +103,8 @@ File to edit: UserService.ts
103
103
  └── Do they need changes too? β†’ Check function signatures
104
104
  ```
105
105
 
106
- > πŸ”΄ **Rule:** Edit the file + all dependent files in the SAME task.
107
- > πŸ”΄ **Never leave broken imports or missing updates.**
106
+ > CRITICAL **Rule:** Edit the file + all dependent files in the SAME task.
107
+ > CRITICAL **Never leave broken imports or missing updates.**
108
108
 
109
109
  ---
110
110
 
@@ -114,13 +114,13 @@ File to edit: UserService.ts
114
114
 
115
115
  | Check | Question |
116
116
  |-------|----------|
117
- | βœ… **Goal met?** | Did I do exactly what user asked? |
118
- | βœ… **Files edited?** | Did I modify all necessary files? |
119
- | βœ… **Code works?** | Did I test/verify the change? |
120
- | βœ… **No errors?** | Lint and TypeScript pass? |
121
- | βœ… **Nothing forgotten?** | Any edge cases missed? |
117
+ | YES **Goal met?** | Did I do exactly what user asked? |
118
+ | YES **Files edited?** | Did I modify all necessary files? |
119
+ | YES **Code works?** | Did I test/verify the change? |
120
+ | YES **No errors?** | Lint and TypeScript pass? |
121
+ | YES **Nothing forgotten?** | Any edge cases missed? |
122
122
 
123
- > πŸ”΄ **Rule:** If ANY check fails, fix it before completing.
123
+ > CRITICAL **Rule:** If ANY check fails, fix it before completing.
124
124
 
125
125
  ---
126
126
 
@@ -132,7 +132,7 @@ This skill is used by **bob-eng (engineer)** agent during the BUILD phase.
132
132
 
133
133
  Add code quality checks to implementation logs:
134
134
  ```markdown
135
- ## πŸ“ˆ Execution Logs
135
+ ## Execution Logs
136
136
 
137
137
  ### Code Quality
138
138
  - [ ] Functions under 20 lines
@@ -55,10 +55,10 @@ metadata:
55
55
 
56
56
  ### Prompt Engineering Review
57
57
  ```markdown
58
- // ❌ Vague prompt in code
58
+ // NO Vague prompt in code
59
59
  const response = await ai.generate(userInput);
60
60
 
61
- // βœ… Structured & Safe prompt
61
+ // YES Structured & Safe prompt
62
62
  const response = await ai.generate({
63
63
  system: "You are a specialized parser...",
64
64
  input: sanitize(userInput),
@@ -69,36 +69,36 @@ const response = await ai.generate({
69
69
  ## Anti-Patterns to Flag
70
70
 
71
71
  ```typescript
72
- // ❌ Magic numbers
72
+ // NO Magic numbers
73
73
  if (status === 3) { ... }
74
74
 
75
- // βœ… Named constants
75
+ // YES Named constants
76
76
  if (status === Status.ACTIVE) { ... }
77
77
 
78
- // ❌ Deep nesting
78
+ // NO Deep nesting
79
79
  if (a) { if (b) { if (c) { ... } } }
80
80
 
81
- // βœ… Early returns
81
+ // YES Early returns
82
82
  if (!a) return;
83
83
  if (!b) return;
84
84
  if (!c) return;
85
85
  // do work
86
86
 
87
- // ❌ Long functions (100+ lines)
88
- // βœ… Small, focused functions
87
+ // NO Long functions (100+ lines)
88
+ // YES Small, focused functions
89
89
 
90
- // ❌ any type
90
+ // NO any type
91
91
  const data: any = ...
92
92
 
93
- // βœ… Proper types
93
+ // YES Proper types
94
94
  const data: UserData = ...
95
95
  ```
96
96
 
97
97
  ## Review Comments Guide
98
98
 
99
99
  ```
100
- // Blocking issues use πŸ”΄
101
- πŸ”΄ BLOCKING: SQL injection vulnerability here
100
+ // Blocking issues use CRITICAL
101
+ CRITICAL BLOCKING: SQL injection vulnerability here
102
102
 
103
103
  // Important suggestions use 🟑
104
104
  🟑 SUGGESTION: Consider using useMemo for performance
@@ -106,8 +106,8 @@ const data: UserData = ...
106
106
  // Minor nits use 🟒
107
107
  🟒 NIT: Prefer const over let for immutable variable
108
108
 
109
- // Questions use ❓
110
- ❓ QUESTION: What happens if user is null here?
109
+ // Questions use [QUESTION]
110
+ [QUESTION] QUESTION: What happens if user is null here?
111
111
  ```
112
112
 
113
113
  ---
@@ -120,7 +120,7 @@ This skill is used by **bob-rev (reviewer)** agent during the VERIFY phase.
120
120
 
121
121
  Add review section to MANUAL:
122
122
  ```markdown
123
- ## πŸ” Review Notes
123
+ ## [SEARCH] Review Notes
124
124
 
125
125
  ### Review Checklist
126
126
  #### Correctness
@@ -153,27 +153,27 @@ Add review section to MANUAL:
153
153
  ### Review Comments
154
154
  | Severity | Comment | File:Line | Status |
155
155
  |----------|----------|-----------|--------|
156
- | πŸ”΄ BLOCKING | [Description] | [File:Line] | [Open/Resolved] |
156
+ | CRITICAL BLOCKING | [Description] | [File:Line] | [Open/Resolved] |
157
157
  | 🟑 SUGGESTION | [Description] | [File:Line] | [Open/Resolved] |
158
158
  | 🟒 NIT | [Description] | [File:Line] | [Open/Resolved] |
159
- | ❓ QUESTION | [Description] | [File:Line] | [Answered] |
159
+ | [QUESTION] QUESTION | [Description] | [File:Line] | [Answered] |
160
160
 
161
161
  ### Review Decision
162
- - [ ] βœ… PASS - Ready for SEND
163
- - [ ] ❌ FAIL - Return to trace for fixes
162
+ - [ ] YES PASS - Ready for SEND
163
+ - [ ] NO FAIL - Return to trace for fixes
164
164
  ```
165
165
 
166
166
  ### PASS/FAIL Criteria
167
167
 
168
168
  #### PASS Conditions
169
- - All πŸ”΄ BLOCKING issues resolved
169
+ - All CRITICAL BLOCKING issues resolved
170
170
  - Security vulnerabilities addressed
171
171
  - Tests pass and have good coverage
172
172
  - Code follows project conventions
173
173
  - No obvious bugs
174
174
 
175
175
  #### FAIL Conditions
176
- - Any unresolved πŸ”΄ BLOCKING issues
176
+ - Any unresolved CRITICAL BLOCKING issues
177
177
  - Security vulnerabilities present
178
178
  - Tests failing or missing
179
179
  - Code doesn't match MANUAL specifications
@@ -184,7 +184,7 @@ Add review section to MANUAL:
184
184
  ```markdown
185
185
  ## 🀝 Agent Handoffs
186
186
 
187
- 🀝 bob-rev: Review complete - βœ… PASS / ❌ FAIL
187
+ 🀝 bob-rev: Review complete - YES PASS / NO FAIL
188
188
  [Decision rationale]
189
189
 
190
190
  🀝 bob-rev β†’ trace: [FAIL - Issues found, please fix]
@@ -212,7 +212,7 @@ When quality issues are discussed:
212
212
 
213
213
  ### Quality Indicators
214
214
 
215
- | Good βœ… | Poor ❌ |
215
+ | Good YES | Poor NO |
216
216
  |---------|---------|
217
217
  | Self-documenting code | Requires comments to explain |
218
218
  | Small, focused functions | God functions (100+ lines) |
@@ -201,7 +201,7 @@ This skill is used by **alice (architect)** agent during PLAN phase and **bob-en
201
201
 
202
202
  Add database section to MANUAL:
203
203
  ```markdown
204
- ## πŸ—οΈ Architecture Analysis
204
+ ## [ARCH] Architecture Analysis
205
205
 
206
206
  ### Database Design
207
207
 
@@ -38,7 +38,7 @@ context7: Documentation lookup for frameworks
38
38
 
39
39
  ## Layer-Specific Exploration
40
40
 
41
- ### πŸ—„οΈ Database Layer
41
+ ### [DB] Database Layer
42
42
 
43
43
  **Find schemas and migrations**:
44
44
  ```bash
@@ -58,7 +58,7 @@ grep("@ManyToOne|@OneToMany|@ManyToMany|references|foreignKey", "src/")
58
58
  LspReferences on entity classes
59
59
  ```
60
60
 
61
- ### πŸ”§ Backend Layer
61
+ ### [TOOL] Backend Layer
62
62
 
63
63
  **Find services and controllers**:
64
64
  ```bash
@@ -84,7 +84,7 @@ LspDefinition on service imports
84
84
  LspReferences on service methods
85
85
  ```
86
86
 
87
- ### πŸ”— Integration Layer
87
+ ### [LINK] Integration Layer
88
88
 
89
89
  **Find external API clients**:
90
90
  ```bash
@@ -104,7 +104,7 @@ glob("**/Dockerfile", "**/docker-compose*", "**/*.yml")
104
104
  glob("**/.github/workflows/**", "**/ci/**")
105
105
  ```
106
106
 
107
- ### 🎨 Frontend Layer
107
+ ### [UI] Frontend Layer
108
108
 
109
109
  **Find components**:
110
110
  ```bash
@@ -131,7 +131,7 @@ LspReferences on component names
131
131
  grep("import.*from.*components", "src/")
132
132
  ```
133
133
 
134
- ### 🎯 UI/UX Layer
134
+ ### [TARGET] UI/UX Layer
135
135
 
136
136
  **Find styles**:
137
137
  ```bash
@@ -6,7 +6,7 @@ description: Performance analysis, bottleneck identification, and optimization s
6
6
 
7
7
  **Skill ID**: performance
8
8
  **Category**: Code Quality & Optimization
9
- **Icon**: πŸ“ˆ
9
+ **Icon**:
10
10
  **Agents**: bob-eng, bob-fix
11
11
 
12
12
  ## Overview
@@ -38,11 +38,11 @@ This skill provides a framework for breaking down work into clear, actionable ta
38
38
 
39
39
  ## Planning Principles (NOT Templates!)
40
40
 
41
- > πŸ”΄ **NO fixed templates. Each plan is UNIQUE to the task.**
41
+ > CRITICAL **NO fixed templates. Each plan is UNIQUE to the task.**
42
42
 
43
43
  ### Principle 1: Keep It SHORT
44
44
 
45
- | ❌ Wrong | βœ… Right |
45
+ | NO Wrong | YES Right |
46
46
  |----------|----------|
47
47
  | 50 tasks with sub-sub-tasks | 5-10 clear tasks max |
48
48
  | Every micro-step listed | Only actionable items |
@@ -54,7 +54,7 @@ This skill provides a framework for breaking down work into clear, actionable ta
54
54
 
55
55
  ### Principle 2: Be SPECIFIC, Not Generic
56
56
 
57
- | ❌ Wrong | βœ… Right |
57
+ | NO Wrong | YES Right |
58
58
  |----------|----------|
59
59
  | "Set up project" | "Run `npx create-next-app`" |
60
60
  | "Add authentication" | "Install next-auth, create `/api/auth/[...nextauth].ts`" |
@@ -85,7 +85,7 @@ This skill provides a framework for breaking down work into clear, actionable ta
85
85
 
86
86
  ### Principle 4: Scripts Are Project-Specific
87
87
 
88
- > πŸ”΄ **DO NOT copy-paste script commands. Choose based on project type.**
88
+ > CRITICAL **DO NOT copy-paste script commands. Choose based on project type.**
89
89
 
90
90
  | Project Type | Relevant Scripts |
91
91
  |--------------|------------------|
@@ -102,7 +102,7 @@ This skill provides a framework for breaking down work into clear, actionable ta
102
102
 
103
103
  ### Principle 5: Verification is Simple
104
104
 
105
- | ❌ Wrong | βœ… Right |
105
+ | NO Wrong | YES Right |
106
106
  |----------|----------|
107
107
  | "Verify the component works correctly" | "Run `npm run dev`, click button, see toast" |
108
108
  | "Test the API" | "curl localhost:3000/api/users returns 200" |
@@ -163,7 +163,7 @@ This skill is used by **alice (architect)** agent during the PLAN phase.
163
163
 
164
164
  Add implementation plan to MANUAL:
165
165
  ```markdown
166
- ## πŸš€ Implementation Plan
166
+ ## [LAUNCH] Implementation Plan
167
167
 
168
168
  ### Layered Tasks
169
169
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  > Think like an attacker, defend like an expert. 2025 threat landscape awareness.
12
12
 
13
- ## πŸ”§ Runtime Scripts
13
+ ## [TOOL] Runtime Scripts
14
14
 
15
15
  **Execute for automated validation:**
16
16
 
@@ -18,7 +18,7 @@ metadata:
18
18
  |--------|---------|-------|
19
19
  | `scripts/security_scan.py` | Validate security principles applied | `python scripts/security_scan.py <project_path>` |
20
20
 
21
- ## πŸ“‹ Reference Files
21
+ ## [LIST] Reference Files
22
22
 
23
23
  | File | Purpose |
24
24
  |------|---------|
@@ -56,14 +56,14 @@ Before scanning, ask:
56
56
  |------|----------|-------------|
57
57
  | **A01** | Broken Access Control | Who can access what? IDOR, SSRF |
58
58
  | **A02** | Security Misconfiguration | Defaults, headers, exposed services |
59
- | **A03** | Software Supply Chain πŸ†• | Dependencies, CI/CD, build integrity |
59
+ | **A03** | Software Supply Chain [NEW] | Dependencies, CI/CD, build integrity |
60
60
  | **A04** | Cryptographic Failures | Weak crypto, exposed secrets |
61
61
  | **A05** | Injection | User input β†’ system commands |
62
62
  | **A06** | Insecure Design | Flawed architecture |
63
63
  | **A07** | Authentication Failures | Session, credential management |
64
64
  | **A08** | Integrity Failures | Unsigned updates, tampered data |
65
65
  | **A09** | Logging & Alerting | Blind spots, no monitoring |
66
- | **A10** | Exceptional Conditions πŸ†• | Error handling, fail-open states |
66
+ | **A10** | Exceptional Conditions [NEW] | Error handling, fail-open states |
67
67
 
68
68
  ### 2025 Key Changes
69
69
 
@@ -226,10 +226,10 @@ Is it actively exploited (EPSS >0.5)?
226
226
 
227
227
  | Layer | You Own | Provider Owns |
228
228
  |-------|---------|---------------|
229
- | Data | βœ… | ❌ |
230
- | Application | βœ… | ❌ |
229
+ | Data | YES | NO |
230
+ | Application | YES | NO |
231
231
  | OS/Runtime | Depends | Depends |
232
- | Infrastructure | ❌ | βœ… |
232
+ | Infrastructure | NO | YES |
233
233
 
234
234
  ### Cloud-Specific Checks
235
235
 
@@ -242,7 +242,7 @@ Is it actively exploited (EPSS >0.5)?
242
242
 
243
243
  ## 10. Anti-Patterns
244
244
 
245
- | ❌ Don't | βœ… Do |
245
+ | NO Don't | YES Do |
246
246
  |----------|-------|
247
247
  | Scan without understanding | Map attack surface first |
248
248
  | Alert on every CVE | Prioritize by exploitability + asset |
@@ -287,7 +287,7 @@ This skill is used by **bob-rev (reviewer)** agent during VERIFY phase and **tra
287
287
 
288
288
  Add security section to MANUAL:
289
289
  ```markdown
290
- ## πŸ” Review Notes
290
+ ## [SEARCH] Review Notes
291
291
 
292
292
  ### Security Checklist
293
293
 
@@ -325,7 +325,7 @@ Add security section to MANUAL:
325
325
 
326
326
  | Severity | Finding | Location | Status |
327
327
  |----------|-----------|-----------|--------|
328
- | πŸ”΄ CRITICAL | [Description] | [File:Line] | [Open/Resolved] |
328
+ | CRITICAL CRITICAL | [Description] | [File:Line] | [Open/Resolved] |
329
329
  | 🟠 HIGH | [Description] | [File:Line] | [Open/Resolved] |
330
330
  | 🟑 MEDIUM | [Description] | [File:Line] | [Open/Resolved] |
331
331
  | 🟒 LOW | [Description] | [File:Line] | [Open/Resolved] |
@@ -339,14 +339,14 @@ Add security section to MANUAL:
339
339
  ### Review Decision (Security-Focused)
340
340
 
341
341
  #### PASS Conditions
342
- - No πŸ”΄ CRITICAL issues
342
+ - No CRITICAL CRITICAL issues
343
343
  - No 🟠 HIGH issues
344
344
  - Supply chain secure (dependencies audited)
345
345
  - No hardcoded secrets in code
346
346
  - Authentication and authorization properly implemented
347
347
 
348
348
  #### FAIL Conditions
349
- - Any πŸ”΄ CRITICAL vulnerabilities
349
+ - Any CRITICAL CRITICAL vulnerabilities
350
350
  - Unresolved 🟠 HIGH vulnerabilities
351
351
  - Hardcoded secrets/API keys found
352
352
  - Supply chain vulnerabilities present
@@ -367,7 +367,7 @@ Add security section to MANUAL:
367
367
 
368
368
  When trace (debugger) investigates security issues:
369
369
  ```markdown
370
- ## πŸ” Debug Logs
370
+ ## [SEARCH] Debug Logs
371
371
 
372
372
  ### Security Issue Analysis
373
373
 
@@ -202,13 +202,13 @@ Document all changes made:
202
202
  ### Changes Reverted
203
203
  1. **[file:line]** - Attempted to flatten query builder conditionals
204
204
  - Reason: Test 'db.handles-concurrent' failed
205
- - Reverted: βœ“
205
+ - Reverted: YES
206
206
 
207
207
  ### Summary
208
208
  - Simplifications made: 2
209
209
  - Simplifications reverted: 1
210
210
  - Passes completed: 2
211
- - Tests still pass: βœ“
211
+ - Tests still pass: YES
212
212
  - Net lines: -21
213
213
  ```
214
214
 
@@ -104,11 +104,11 @@ pm2 logs app-name --err --lines 100
104
104
 
105
105
  ## Anti-Patterns
106
106
 
107
- ❌ **Random changes** - "Maybe if I change this..."
108
- ❌ **Ignoring evidence** - "That can't be the cause"
109
- ❌ **Assuming** - "It must be X" without proof
110
- ❌ **Not reproducing first** - Fixing blindly
111
- ❌ **Stopping at symptoms** - Not finding root cause
107
+ NO **Random changes** - "Maybe if I change this..."
108
+ NO **Ignoring evidence** - "That can't be the cause"
109
+ NO **Assuming** - "It must be X" without proof
110
+ NO **Not reproducing first** - Fixing blindly
111
+ NO **Stopping at symptoms** - Not finding root cause
112
112
 
113
113
  ---
114
114
 
@@ -120,7 +120,7 @@ This skill is used by **trace (debugger)** agent during the FIX phase.
120
120
 
121
121
  Add debugging section to MANUAL:
122
122
  ```markdown
123
- ## πŸ” Debug Logs
123
+ ## [SEARCH] Debug Logs
124
124
 
125
125
  ### Issue Summary
126
126
  - **Bug ID:** [BUG-001]
@@ -167,7 +167,7 @@ metadata:
167
167
 
168
168
  ## 10. Anti-Patterns
169
169
 
170
- | ❌ Don't | βœ… Do |
170
+ | NO Don't | YES Do |
171
171
  |----------|-------|
172
172
  | Test implementation | Test behavior |
173
173
  | Duplicate test code | Use factories |
@@ -9,6 +9,39 @@ import { ConcurrencyManager } from "./concurrency";
9
9
 
10
10
  const TASK_TTL_MS = 30 * 60 * 1000; // 30 minutes
11
11
  const MIN_STABILITY_TIME_MS = 10 * 1000; // 10 seconds before stability detection
12
+ const MAX_SYSTEM_CONTENT_LENGTH = 50000; // Maximum characters for system prompt
13
+ const MAX_PROMPT_LENGTH = 10000; // Maximum characters for user prompt
14
+
15
+ /**
16
+ * Sanitize content for safe JSON transmission to kimi model
17
+ * Handles Unicode issues, control characters, and length limits
18
+ */
19
+ function sanitizeForModel(content: string, maxLength: number = MAX_SYSTEM_CONTENT_LENGTH): string {
20
+ if (!content) return "";
21
+
22
+ // Step 1: Remove control characters (keep only \n, \r, \t)
23
+ let sanitized = content
24
+ .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '')
25
+ // Step 2: Replace Unicode line/paragraph separators
26
+ .replace(/\u2028/g, '\n')
27
+ .replace(/\u2029/g, '\n')
28
+ // Step 3: Replace other problematic Unicode
29
+ .replace(/\uFEFF/g, '') // BOM
30
+ .replace(/\u200B-\u200D/g, '') // Zero-width spaces
31
+ // Step 4: Escape backslashes to prevent JSON issues
32
+ .replace(/\\/g, '\\\\')
33
+ // Step 5: Normalize line endings
34
+ .replace(/\r\n/g, '\n')
35
+ .replace(/\r/g, '\n');
36
+
37
+ // Step 6: Truncate if too long (with indicator)
38
+ if (sanitized.length > maxLength) {
39
+ const truncationMsg = "\n\n[Content truncated due to length limits]";
40
+ sanitized = sanitized.substring(0, maxLength - truncationMsg.length) + truncationMsg;
41
+ }
42
+
43
+ return sanitized;
44
+ }
12
45
 
13
46
  type OpencodeClient = PluginInput["client"];
14
47
 
@@ -118,11 +151,8 @@ export class BackgroundManager {
118
151
  const skillPath = join(this.directory, ".opencode", "skill", "bobs-workshop", skillName, "SKILL.md");
119
152
  if (existsSync(skillPath)) {
120
153
  let skillFile = readFileSync(skillPath, "utf8");
121
- // Sanitize content to prevent JSON parsing issues with kimi model
122
- skillFile = skillFile
123
- .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
124
- .replace(/\u2028/g, '\n') // Replace line separator with newline
125
- .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
154
+ // Sanitize content for kimi model compatibility
155
+ skillFile = sanitizeForModel(skillFile, 10000); // Limit per skill
126
156
  skillContent += `\n\n---\n## Skill: ${skillName}\n\n${skillFile}`;
127
157
  }
128
158
  }
@@ -133,18 +163,20 @@ export class BackgroundManager {
133
163
  const { existsSync, readFileSync } = await import("node:fs");
134
164
  if (existsSync(input.manual_path)) {
135
165
  let manualContent = readFileSync(input.manual_path, "utf8");
136
- // Sanitize content to prevent JSON parsing issues with kimi model
137
- // Remove control characters and ensure proper escaping
138
- manualContent = manualContent
139
- .replace(/[\x00-\x08\x0B-\x0C\x0E-\x1F]/g, '') // Remove control chars except \n, \r, \t
140
- .replace(/\u2028/g, '\n') // Replace line separator with newline
141
- .replace(/\u2029/g, '\n'); // Replace paragraph separator with newline
166
+ // Sanitize content for kimi model compatibility
167
+ manualContent = sanitizeForModel(manualContent, 30000); // Larger limit for manual
142
168
  skillContent = skillContent
143
169
  ? `${skillContent}\n\n## MANUAL Context:\n${manualContent}`
144
170
  : manualContent;
145
171
  }
146
172
  }
173
+
174
+ // Final sanitization of combined skill content
175
+ skillContent = sanitizeForModel(skillContent, MAX_SYSTEM_CONTENT_LENGTH);
147
176
 
177
+ // Sanitize user prompt to prevent JSON issues
178
+ const sanitizedPrompt = sanitizeForModel(input.prompt, MAX_PROMPT_LENGTH);
179
+
148
180
  // Fire-and-forget prompt
149
181
  this.client.session.prompt({
150
182
  path: { id: sessionID },
@@ -156,7 +188,7 @@ export class BackgroundManager {
156
188
  task: false,
157
189
  delegate_task: false,
158
190
  },
159
- parts: [{ type: "text", text: input.prompt }],
191
+ parts: [{ type: "text", text: sanitizedPrompt }],
160
192
  },
161
193
  } as any).catch((error) => {
162
194
  console.error("[background-agent] Prompt error:", error);