knowzcode 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/.claude-plugin/marketplace.json +55 -0
- package/.claude-plugin/plugin.json +8 -0
- package/LICENSE +121 -0
- package/README.md +223 -0
- package/agents/analyst.md +121 -0
- package/agents/architect.md +121 -0
- package/agents/builder.md +155 -0
- package/agents/closer.md +148 -0
- package/agents/knowledge-migrator.md +349 -0
- package/agents/microfix-specialist.md +140 -0
- package/agents/reviewer.md +220 -0
- package/agents/update-coordinator.md +405 -0
- package/bin/knowzcode.mjs +869 -0
- package/commands/audit.md +108 -0
- package/commands/connect-mcp.md +507 -0
- package/commands/fix.md +107 -0
- package/commands/init.md +320 -0
- package/commands/learn.md +308 -0
- package/commands/plan.md +125 -0
- package/commands/register.md +724 -0
- package/commands/status.md +291 -0
- package/commands/telemetry-setup.md +368 -0
- package/commands/telemetry.md +188 -0
- package/commands/work.md +390 -0
- package/knowzcode/automation_manifest.md +59 -0
- package/knowzcode/claude_code_execution.md +133 -0
- package/knowzcode/enterprise/compliance_manifest.md +132 -0
- package/knowzcode/enterprise/compliance_status.md +30 -0
- package/knowzcode/enterprise/guidelines/code-quality.md +67 -0
- package/knowzcode/enterprise/guidelines/custom/.gitkeep +0 -0
- package/knowzcode/enterprise/guidelines/security.md +355 -0
- package/knowzcode/enterprise/reports/.gitkeep +0 -0
- package/knowzcode/enterprise/templates/guideline-template.md +55 -0
- package/knowzcode/gitignore.template +13 -0
- package/knowzcode/knowzcode_architecture.md +51 -0
- package/knowzcode/knowzcode_log.md +142 -0
- package/knowzcode/knowzcode_loop.md +515 -0
- package/knowzcode/knowzcode_project.md +233 -0
- package/knowzcode/knowzcode_tracker.md +40 -0
- package/knowzcode/knowzcode_vaults.md +104 -0
- package/knowzcode/mcp_config.md +166 -0
- package/knowzcode/planning/Readme.md +6 -0
- package/knowzcode/platform_adapters.md +388 -0
- package/knowzcode/prompts/Execute_Micro_Fix.md +57 -0
- package/knowzcode/prompts/Investigate_Codebase.md +227 -0
- package/knowzcode/prompts/Migrate_Knowledge.md +301 -0
- package/knowzcode/prompts/Refactor_Node.md +72 -0
- package/knowzcode/prompts/Spec_Verification_Checkpoint.md +59 -0
- package/knowzcode/prompts/[LOOP_1A]__Propose_Change_Set.md +52 -0
- package/knowzcode/prompts/[LOOP_1B]__Draft_Specs.md +75 -0
- package/knowzcode/prompts/[LOOP_2A]__Implement_Change_Set.md +55 -0
- package/knowzcode/prompts/[LOOP_2B]__Verify_Implementation.md +72 -0
- package/knowzcode/prompts/[LOOP_3]__Finalize_And_Commit.md +67 -0
- package/knowzcode/specs/Readme.md +10 -0
- package/knowzcode/telemetry_config.md +89 -0
- package/knowzcode/user_preferences.md +120 -0
- package/package.json +53 -0
- package/skills/alias-resolver.json +15 -0
- package/skills/architecture-diff.json +12 -0
- package/skills/check-installation-status.json +14 -0
- package/skills/continue.md +105 -0
- package/skills/environment-guard.json +12 -0
- package/skills/generate-workgroup-id.json +25 -0
- package/skills/install-knowzcode.json +21 -0
- package/skills/load-core-context.json +18 -0
- package/skills/log-entry-builder.json +15 -0
- package/skills/spec-quality-check.json +14 -0
- package/skills/spec-template.json +15 -0
- package/skills/spec-validator.json +25 -0
- package/skills/start-work.md +224 -0
- package/skills/tracker-scan.json +12 -0
- package/skills/tracker-update.json +28 -0
- package/skills/validate-installation.json +14 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
---
|
|
2
|
+
guideline_id: SEC-001
|
|
3
|
+
name: Security Guidelines
|
|
4
|
+
version: "1.0"
|
|
5
|
+
last_updated: "2025-01-29"
|
|
6
|
+
enforcement: blocking
|
|
7
|
+
applies_to: both
|
|
8
|
+
categories:
|
|
9
|
+
- authentication
|
|
10
|
+
- authorization
|
|
11
|
+
- data-protection
|
|
12
|
+
- injection-prevention
|
|
13
|
+
- logging
|
|
14
|
+
priority: critical
|
|
15
|
+
owner: security-team
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Security Guidelines
|
|
19
|
+
|
|
20
|
+
**Purpose:** Ensure all specifications and implementations meet enterprise security requirements based on industry best practices and OWASP guidelines.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Authentication Requirements
|
|
25
|
+
|
|
26
|
+
### SEC-AUTH-01: Secure Password Handling
|
|
27
|
+
|
|
28
|
+
**Requirement:** All passwords MUST be hashed using bcrypt (cost >= 10) or Argon2. Plaintext passwords MUST never be stored or logged.
|
|
29
|
+
|
|
30
|
+
**Applies To:** implementation
|
|
31
|
+
|
|
32
|
+
**Severity:** critical
|
|
33
|
+
|
|
34
|
+
**ARC Verification:**
|
|
35
|
+
- ARC_SEC_AUTH_01a: Verify password storage uses bcrypt with cost >= 10 OR Argon2
|
|
36
|
+
- ARC_SEC_AUTH_01b: Verify plaintext passwords are never logged or stored in databases
|
|
37
|
+
- ARC_SEC_AUTH_01c: Verify password comparison uses constant-time comparison function
|
|
38
|
+
|
|
39
|
+
**Compliant Example:**
|
|
40
|
+
```typescript
|
|
41
|
+
import bcrypt from 'bcrypt';
|
|
42
|
+
|
|
43
|
+
async function hashPassword(password: string): Promise<string> {
|
|
44
|
+
const saltRounds = 12; // cost factor >= 10
|
|
45
|
+
return bcrypt.hash(password, saltRounds);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function verifyPassword(password: string, hash: string): Promise<boolean> {
|
|
49
|
+
return bcrypt.compare(password, hash); // constant-time comparison
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Non-Compliant Example:**
|
|
54
|
+
```typescript
|
|
55
|
+
// VIOLATION: Storing plaintext password
|
|
56
|
+
db.users.insert({ password: userPassword });
|
|
57
|
+
|
|
58
|
+
// VIOLATION: Using weak hashing algorithm
|
|
59
|
+
const hash = crypto.createHash('md5').update(password).digest('hex');
|
|
60
|
+
|
|
61
|
+
// VIOLATION: Non-constant-time comparison
|
|
62
|
+
if (storedPassword === inputPassword) { /* ... */ }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Remediation:** Replace plaintext storage or weak hashing with bcrypt. Use library's built-in compare function for constant-time comparison.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### SEC-AUTH-02: Session Management
|
|
70
|
+
|
|
71
|
+
**Requirement:** Sessions MUST have secure cookie settings and configurable expiry. Session tokens MUST be regenerated after authentication.
|
|
72
|
+
|
|
73
|
+
**Applies To:** both
|
|
74
|
+
|
|
75
|
+
**Severity:** high
|
|
76
|
+
|
|
77
|
+
**ARC Verification:**
|
|
78
|
+
- ARC_SEC_AUTH_02a: Verify session cookies have HttpOnly flag set to true
|
|
79
|
+
- ARC_SEC_AUTH_02b: Verify session cookies have Secure flag in production environment
|
|
80
|
+
- ARC_SEC_AUTH_02c: Verify session expiry is configurable and defaults to <= 24 hours
|
|
81
|
+
- ARC_SEC_AUTH_02d: Verify session token is regenerated after successful login
|
|
82
|
+
- ARC_SEC_AUTH_02e: Spec MUST document session lifecycle and security properties
|
|
83
|
+
|
|
84
|
+
**Compliant Example:**
|
|
85
|
+
```typescript
|
|
86
|
+
app.use(session({
|
|
87
|
+
secret: process.env.SESSION_SECRET,
|
|
88
|
+
cookie: {
|
|
89
|
+
httpOnly: true,
|
|
90
|
+
secure: process.env.NODE_ENV === 'production',
|
|
91
|
+
sameSite: 'strict',
|
|
92
|
+
maxAge: 24 * 60 * 60 * 1000 // 24 hours max
|
|
93
|
+
},
|
|
94
|
+
resave: false,
|
|
95
|
+
saveUninitialized: false
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
// Regenerate session after login
|
|
99
|
+
req.session.regenerate((err) => {
|
|
100
|
+
req.session.userId = user.id;
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Non-Compliant Example:**
|
|
105
|
+
```typescript
|
|
106
|
+
// VIOLATION: Insecure cookie settings
|
|
107
|
+
app.use(session({
|
|
108
|
+
secret: 'hardcoded-secret', // Never hardcode secrets
|
|
109
|
+
cookie: {
|
|
110
|
+
httpOnly: false, // Allows XSS to steal session
|
|
111
|
+
secure: false, // Allows interception over HTTP
|
|
112
|
+
// Missing maxAge = potential infinite session
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 2. Authorization Requirements
|
|
120
|
+
|
|
121
|
+
### SEC-AUTHZ-01: Role-Based Access Control
|
|
122
|
+
|
|
123
|
+
**Requirement:** All protected resources MUST implement server-side authorization checks. Authorization MUST NOT rely solely on client-side controls.
|
|
124
|
+
|
|
125
|
+
**Applies To:** both
|
|
126
|
+
|
|
127
|
+
**Severity:** critical
|
|
128
|
+
|
|
129
|
+
**ARC Verification:**
|
|
130
|
+
- ARC_SEC_AUTHZ_01a: Verify all API endpoints have authorization middleware
|
|
131
|
+
- ARC_SEC_AUTHZ_01b: Verify authorization is enforced server-side, not client-only
|
|
132
|
+
- ARC_SEC_AUTHZ_01c: Verify Spec documents required roles/permissions per endpoint
|
|
133
|
+
- ARC_SEC_AUTHZ_01d: Verify authorization failures return 403 Forbidden (not 404)
|
|
134
|
+
|
|
135
|
+
**Compliant Example:**
|
|
136
|
+
```typescript
|
|
137
|
+
// Server-side authorization middleware
|
|
138
|
+
const authorize = (roles: string[]) => (req, res, next) => {
|
|
139
|
+
if (!req.user || !roles.includes(req.user.role)) {
|
|
140
|
+
return res.status(403).json({ error: 'Forbidden' });
|
|
141
|
+
}
|
|
142
|
+
next();
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
router.delete('/users/:id',
|
|
146
|
+
authenticate,
|
|
147
|
+
authorize(['admin']), // Server-side role check
|
|
148
|
+
deleteUserHandler
|
|
149
|
+
);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Non-Compliant Example:**
|
|
153
|
+
```typescript
|
|
154
|
+
// VIOLATION: No server-side authorization
|
|
155
|
+
router.delete('/users/:id', deleteUserHandler); // Anyone can delete!
|
|
156
|
+
|
|
157
|
+
// VIOLATION: Client-only authorization (easily bypassed)
|
|
158
|
+
// Frontend: if (user.role === 'admin') showDeleteButton()
|
|
159
|
+
// Backend: router.delete('/users/:id', deleteUserHandler); // No check!
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### SEC-AUTHZ-02: IDOR Prevention
|
|
165
|
+
|
|
166
|
+
**Requirement:** Resource access MUST verify the requesting user has permission to access the specific resource, not just the resource type.
|
|
167
|
+
|
|
168
|
+
**Applies To:** implementation
|
|
169
|
+
|
|
170
|
+
**Severity:** critical
|
|
171
|
+
|
|
172
|
+
**ARC Verification:**
|
|
173
|
+
- ARC_SEC_AUTHZ_02a: Verify resource ownership is checked before returning data
|
|
174
|
+
- ARC_SEC_AUTHZ_02b: Verify users cannot access other users' data by changing IDs in requests
|
|
175
|
+
|
|
176
|
+
**Compliant Example:**
|
|
177
|
+
```typescript
|
|
178
|
+
// Check ownership before returning resource
|
|
179
|
+
async function getDocument(req, res) {
|
|
180
|
+
const doc = await Document.findById(req.params.id);
|
|
181
|
+
if (!doc) return res.status(404).json({ error: 'Not found' });
|
|
182
|
+
|
|
183
|
+
// IDOR prevention: verify ownership
|
|
184
|
+
if (doc.ownerId !== req.user.id && !req.user.isAdmin) {
|
|
185
|
+
return res.status(403).json({ error: 'Forbidden' });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
res.json(doc);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 3. Data Protection Requirements
|
|
195
|
+
|
|
196
|
+
### SEC-DATA-01: Sensitive Data Handling
|
|
197
|
+
|
|
198
|
+
**Requirement:** PII and sensitive data MUST be encrypted at rest and in transit. Data classification MUST be documented in specs.
|
|
199
|
+
|
|
200
|
+
**Applies To:** both
|
|
201
|
+
|
|
202
|
+
**Severity:** critical
|
|
203
|
+
|
|
204
|
+
**ARC Verification:**
|
|
205
|
+
- ARC_SEC_DATA_01a: Verify database connections use TLS/SSL
|
|
206
|
+
- ARC_SEC_DATA_01b: Verify PII fields are encrypted or appropriately protected
|
|
207
|
+
- ARC_SEC_DATA_01c: Verify Spec includes data classification (Public/Internal/Confidential/Secret)
|
|
208
|
+
- ARC_SEC_DATA_01d: Verify sensitive data is not included in logs or error messages
|
|
209
|
+
|
|
210
|
+
**Compliant Example:**
|
|
211
|
+
```typescript
|
|
212
|
+
// TLS connection to database
|
|
213
|
+
const pool = new Pool({
|
|
214
|
+
connectionString: process.env.DATABASE_URL,
|
|
215
|
+
ssl: { rejectUnauthorized: true }
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Encrypt sensitive fields
|
|
219
|
+
const encryptedSSN = encrypt(user.ssn, process.env.ENCRYPTION_KEY);
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 4. Injection Prevention
|
|
225
|
+
|
|
226
|
+
### SEC-INJ-01: SQL Injection Prevention
|
|
227
|
+
|
|
228
|
+
**Requirement:** All database queries MUST use parameterized queries, prepared statements, or ORM methods. String concatenation in queries is PROHIBITED.
|
|
229
|
+
|
|
230
|
+
**Applies To:** implementation
|
|
231
|
+
|
|
232
|
+
**Severity:** critical
|
|
233
|
+
|
|
234
|
+
**ARC Verification:**
|
|
235
|
+
- ARC_SEC_INJ_01a: Verify no string concatenation or template literals in SQL queries
|
|
236
|
+
- ARC_SEC_INJ_01b: Verify ORM is used OR parameterized queries exclusively
|
|
237
|
+
|
|
238
|
+
**Compliant Example:**
|
|
239
|
+
```typescript
|
|
240
|
+
// Using ORM (Prisma)
|
|
241
|
+
const user = await prisma.user.findUnique({ where: { id: userId } });
|
|
242
|
+
|
|
243
|
+
// Using parameterized query
|
|
244
|
+
const result = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
|
|
245
|
+
|
|
246
|
+
// Using prepared statement
|
|
247
|
+
const stmt = db.prepare('SELECT * FROM users WHERE email = ?');
|
|
248
|
+
const user = stmt.get(email);
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Non-Compliant Example:**
|
|
252
|
+
```typescript
|
|
253
|
+
// VIOLATION: SQL Injection vulnerable - string concatenation
|
|
254
|
+
const result = await db.query(`SELECT * FROM users WHERE id = ${userId}`);
|
|
255
|
+
|
|
256
|
+
// VIOLATION: SQL Injection vulnerable - template literal
|
|
257
|
+
const query = `SELECT * FROM users WHERE name = '${userName}'`;
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### SEC-INJ-02: XSS Prevention
|
|
263
|
+
|
|
264
|
+
**Requirement:** All user input displayed in HTML MUST be properly escaped or sanitized. Framework auto-escaping should not be bypassed without explicit security review.
|
|
265
|
+
|
|
266
|
+
**Applies To:** implementation
|
|
267
|
+
|
|
268
|
+
**Severity:** high
|
|
269
|
+
|
|
270
|
+
**ARC Verification:**
|
|
271
|
+
- ARC_SEC_INJ_02a: Verify user input is escaped before rendering in HTML
|
|
272
|
+
- ARC_SEC_INJ_02b: Verify dangerouslySetInnerHTML (React) or v-html (Vue) usage is justified and sanitized
|
|
273
|
+
- ARC_SEC_INJ_02c: Verify Content-Security-Policy headers are configured
|
|
274
|
+
|
|
275
|
+
**Compliant Example:**
|
|
276
|
+
```typescript
|
|
277
|
+
// React auto-escapes by default
|
|
278
|
+
return <div>{userInput}</div>; // Safe
|
|
279
|
+
|
|
280
|
+
// If HTML is required, sanitize first
|
|
281
|
+
import DOMPurify from 'dompurify';
|
|
282
|
+
const sanitized = DOMPurify.sanitize(userInput);
|
|
283
|
+
return <div dangerouslySetInnerHTML={{ __html: sanitized }} />;
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Non-Compliant Example:**
|
|
287
|
+
```typescript
|
|
288
|
+
// VIOLATION: Unsanitized HTML injection
|
|
289
|
+
return <div dangerouslySetInnerHTML={{ __html: userInput }} />;
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## 5. Logging Requirements
|
|
295
|
+
|
|
296
|
+
### SEC-LOG-01: Security Event Logging
|
|
297
|
+
|
|
298
|
+
**Requirement:** Authentication events (login success/failure, logout, password changes) MUST be logged with audit trail. Logs MUST NOT contain passwords, tokens, or other secrets.
|
|
299
|
+
|
|
300
|
+
**Applies To:** implementation
|
|
301
|
+
|
|
302
|
+
**Severity:** high
|
|
303
|
+
|
|
304
|
+
**ARC Verification:**
|
|
305
|
+
- ARC_SEC_LOG_01a: Verify login attempts (success and failure) are logged
|
|
306
|
+
- ARC_SEC_LOG_01b: Verify logs do NOT contain passwords, tokens, or API keys
|
|
307
|
+
- ARC_SEC_LOG_01c: Verify log entries include timestamp, user ID, event type, IP address
|
|
308
|
+
- ARC_SEC_LOG_01d: Verify password change events are logged
|
|
309
|
+
|
|
310
|
+
**Compliant Example:**
|
|
311
|
+
```typescript
|
|
312
|
+
// Structured security logging
|
|
313
|
+
logger.info({
|
|
314
|
+
event: 'login_success',
|
|
315
|
+
userId: user.id,
|
|
316
|
+
email: user.email,
|
|
317
|
+
ip: req.ip,
|
|
318
|
+
userAgent: req.headers['user-agent'],
|
|
319
|
+
timestamp: new Date().toISOString()
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// Never log sensitive data
|
|
323
|
+
logger.info({ event: 'login_attempt', email }); // Good
|
|
324
|
+
logger.info({ event: 'login_attempt', email, password }); // NEVER!
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Non-Compliant Example:**
|
|
328
|
+
```typescript
|
|
329
|
+
// VIOLATION: Logging sensitive data
|
|
330
|
+
logger.info(`User ${email} logged in with password ${password}`);
|
|
331
|
+
logger.debug({ user, token: authToken }); // Leaking token
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Compliance Summary
|
|
337
|
+
|
|
338
|
+
| ID | Requirement | Severity | Scope | Category |
|
|
339
|
+
|:---|:------------|:---------|:------|:---------|
|
|
340
|
+
| SEC-AUTH-01 | Secure Password Handling | critical | implementation | authentication |
|
|
341
|
+
| SEC-AUTH-02 | Session Management | high | both | authentication |
|
|
342
|
+
| SEC-AUTHZ-01 | Role-Based Access Control | critical | both | authorization |
|
|
343
|
+
| SEC-AUTHZ-02 | IDOR Prevention | critical | implementation | authorization |
|
|
344
|
+
| SEC-DATA-01 | Sensitive Data Handling | critical | both | data-protection |
|
|
345
|
+
| SEC-INJ-01 | SQL Injection Prevention | critical | implementation | injection-prevention |
|
|
346
|
+
| SEC-INJ-02 | XSS Prevention | high | implementation | injection-prevention |
|
|
347
|
+
| SEC-LOG-01 | Security Event Logging | high | implementation | logging |
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## References
|
|
352
|
+
|
|
353
|
+
- [OWASP Top 10](https://owasp.org/Top10/)
|
|
354
|
+
- [OWASP Authentication Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html)
|
|
355
|
+
- [OWASP Session Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html)
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
guideline_id: CUSTOM-001
|
|
3
|
+
name: "[Guideline Name]"
|
|
4
|
+
enforcement: advisory
|
|
5
|
+
applies_to: both
|
|
6
|
+
priority: medium
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# [Guideline Name]
|
|
10
|
+
|
|
11
|
+
**Purpose:** [Brief description of what this guideline ensures]
|
|
12
|
+
|
|
13
|
+
> **Instructions:**
|
|
14
|
+
> 1. Copy this template to `knowzcode/enterprise/guidelines/` or `guidelines/custom/`
|
|
15
|
+
> 2. Fill in sections relevant to your organization
|
|
16
|
+
> 3. Add to `compliance_manifest.md` Active Guidelines table
|
|
17
|
+
> 4. Set `Active` to `true` in the manifest
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 1. [Category Name]
|
|
22
|
+
|
|
23
|
+
### [ID]: [Requirement Title]
|
|
24
|
+
|
|
25
|
+
**Requirement:** [Clear statement of what MUST/SHOULD be done]
|
|
26
|
+
|
|
27
|
+
**Applies To:** [spec | implementation | both]
|
|
28
|
+
|
|
29
|
+
**Severity:** [critical | high | medium | low]
|
|
30
|
+
|
|
31
|
+
**ARC Verification:**
|
|
32
|
+
- ARC_[ID]_a: Verify that [specific testable condition]
|
|
33
|
+
- ARC_[ID]_b: Verify that [specific testable condition]
|
|
34
|
+
|
|
35
|
+
**Compliant Example:**
|
|
36
|
+
```
|
|
37
|
+
// Example of code/spec that meets the requirement
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Non-Compliant Example:**
|
|
41
|
+
```
|
|
42
|
+
// VIOLATION: [Explain why this violates the requirement]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Remediation:** [Steps to fix violations]
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Compliance Summary
|
|
50
|
+
|
|
51
|
+
| ID | Requirement | Severity | Scope |
|
|
52
|
+
|:---|:------------|:---------|:------|
|
|
53
|
+
| [ID] | [Title] | [severity] | [scope] |
|
|
54
|
+
|
|
55
|
+
---
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# KnowzCode Environment-Specific Files
|
|
2
|
+
# These files contain local development environment details
|
|
3
|
+
# and should remain purely local to each checkout
|
|
4
|
+
|
|
5
|
+
# Environment context (filled during init, unique per dev environment)
|
|
6
|
+
environment_context.md
|
|
7
|
+
|
|
8
|
+
# Session-specific WorkGroup data
|
|
9
|
+
workgroups/
|
|
10
|
+
|
|
11
|
+
# Personal notes and scratch files
|
|
12
|
+
*.local.md
|
|
13
|
+
.scratch/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ◆ KnowzCode - Architectural Flowchart
|
|
2
|
+
|
|
3
|
+
**Purpose:** This document contains the Mermaid flowchart defining the architecture, components (NodeIDs), and their primary interactions for this project. This visual map is the source of truth for all implementable components tracked in `knowzcode_tracker.md`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TD
|
|
9
|
+
%% =================================================================
|
|
10
|
+
%% Legend - Defines the shapes and conventions used in this diagram
|
|
11
|
+
%% =================================================================
|
|
12
|
+
subgraph Legend
|
|
13
|
+
direction LR
|
|
14
|
+
L_IDConv(NodeID Convention: TYPE_Name)
|
|
15
|
+
L_Proc([Process/Backend Logic])
|
|
16
|
+
L_UI[/UI Component/]
|
|
17
|
+
L_Decision{Decision Point}
|
|
18
|
+
L_DB[(Database/Data Store)]
|
|
19
|
+
L_ExtAPI{{External API}}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
%% =================================================================
|
|
23
|
+
%% High-Level Application Flow
|
|
24
|
+
%% This is a placeholder. Replace with your project's actual architecture.
|
|
25
|
+
%% =================================================================
|
|
26
|
+
User((User)) --> UI_LoginPage[/Login Page/]
|
|
27
|
+
|
|
28
|
+
subgraph "Authentication Feature"
|
|
29
|
+
direction TB
|
|
30
|
+
UI_LoginPage -- Credentials --> API_Auth[API: Authenticate User]
|
|
31
|
+
API_Auth --> DB_Users[(User Database)]
|
|
32
|
+
API_Auth --> Auth_Decision{Is Valid?}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Auth_Decision -- Yes --> UI_Dashboard[/User Dashboard/]
|
|
36
|
+
Auth_Decision -- No --> UI_LoginPage
|
|
37
|
+
|
|
38
|
+
subgraph "Dashboard Feature"
|
|
39
|
+
direction TB
|
|
40
|
+
UI_Dashboard -- Request Data --> API_GetData[API: Get User Data]
|
|
41
|
+
API_GetData --> SVC_DataAggregator[Service: Aggregate Data]
|
|
42
|
+
SVC_DataAggregator --> DB_Products[(Product DB)]
|
|
43
|
+
SVC_DataAggregator --> DB_Orders[(Order DB)]
|
|
44
|
+
SVC_DataAggregator -- Aggregated Data --> API_GetData
|
|
45
|
+
API_GetData -- Formatted Data --> UI_Dashboard
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
(This is a template showing a sample application structure. Replace the entire Mermaid content above with the specific flowchart for your project. Use the architecture_generator.md guide for assistance in creating a new flowchart from a project idea.)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# ◆ KnowzCode - Operational Record
|
|
2
|
+
|
|
3
|
+
**Purpose:** This document serves two primary functions for KnowzCode:
|
|
4
|
+
1. **Operational Log**: A chronological, structured record of significant events, decisions, verification outcomes, and artifact changes during the project lifecycle. Maintained by the KnowzCode AI Agent as per `knowzcode_loop.md`.
|
|
5
|
+
2. **Reference Quality Criteria**: A standard list of code quality principles referenced during ARC (Attentive Review & Compliance)-Based Verification.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Section 1: Operational Log
|
|
10
|
+
|
|
11
|
+
**(Instructions for AI Agent: New entries are to be PREPENDED to this section. Use the file modification command specified in your `environment_context.md`. Each entry MUST be separated by `---`, and its `Timestamp` MUST be generated using the timestamp command from your `environment_context.md`.)**
|
|
12
|
+
---
|
|
13
|
+
**[NEWEST ENTRIES APPEAR HERE - DO NOT REMOVE THIS MARKER]**
|
|
14
|
+
---
|
|
15
|
+
**Type:** SystemInitialization
|
|
16
|
+
**Timestamp:** [Generated Timestamp]
|
|
17
|
+
**NodeID(s):** Project-Wide
|
|
18
|
+
**Logged By:** KnowzCodeSetup
|
|
19
|
+
**Details:**
|
|
20
|
+
KnowzCode project structure and core files initialized.
|
|
21
|
+
- `knowzcode/knowzcode_project.md` (template created)
|
|
22
|
+
- `knowzcode/knowzcode_architecture.md` (template created)
|
|
23
|
+
- `knowzcode/knowzcode_tracker.md` (template created)
|
|
24
|
+
- `knowzcode/knowzcode_loop.md` (created)
|
|
25
|
+
- `knowzcode/knowzcode_log.md` (this file - initialized)
|
|
26
|
+
- `knowzcode/specs/` directory (created)
|
|
27
|
+
---
|
|
28
|
+
**Type:** SpecApproved
|
|
29
|
+
**Timestamp:** [Generated Timestamp]
|
|
30
|
+
**NodeID(s):** [ExampleNodeID]
|
|
31
|
+
**Logged By:** AI-Agent (via Orchestrator)
|
|
32
|
+
**Details:**
|
|
33
|
+
Specification for `[ExampleNodeID]` has been reviewed and approved by the Orchestrator.
|
|
34
|
+
- Key requirements confirmed: [Brief summary or reference to spec version if applicable]
|
|
35
|
+
- Agent will now proceed with ARC-Principle-Based Planning for implementation.
|
|
36
|
+
---
|
|
37
|
+
**Type:** ◆ ARC-Completion
|
|
38
|
+
**Timestamp:** [Generated Timestamp]
|
|
39
|
+
**WorkGroupID:** kc-[The ID for this Change Set]
|
|
40
|
+
**NodeID(s):** [List ALL NodeIDs in the Change Set]
|
|
41
|
+
**Logged By:** KnowzCode AI-Agent
|
|
42
|
+
**Details:**
|
|
43
|
+
◆ Successfully implemented and verified the Change Set for [PrimaryGoal].
|
|
44
|
+
- **ARC Verification Summary:** All ARC Criteria met for all nodes in the WorkGroupID. [Mention key checks performed].
|
|
45
|
+
- **Architectural Learnings:** [Any discoveries about the overall architecture or patterns].
|
|
46
|
+
- **Unforeseen Ripple Effects:** [NodeIDs (outside of this WorkGroupID) whose specs may now need review: None | List affected nodes and reason].
|
|
47
|
+
- **Specification Finalization:** All specs for the listed NodeIDs updated to "as-built" state.
|
|
48
|
+
- **Flowchart Consistency Check Outcome:** [e.g., 'No discrepancies found.', 'Applied simple update: Added link X->Y.', 'Discrepancy noted for Orchestrator review: Node Z interaction requires flowchart restructuring.'].
|
|
49
|
+
---
|
|
50
|
+
**Type:** MicroFix
|
|
51
|
+
**Timestamp:** [Generated Timestamp]
|
|
52
|
+
**NodeID(s)/File:** [TargetNodeID or file_path]
|
|
53
|
+
**Logged By:** AI-Agent (via Orchestrator)
|
|
54
|
+
**Details:**
|
|
55
|
+
- **User Request:** [Orchestrator's brief issue description].
|
|
56
|
+
- **Action Taken:** [Brief description of change made].
|
|
57
|
+
- **Verification:** [Brief verification method/outcome, e.g., "Confirmed visually", "Ran specific test X"].
|
|
58
|
+
---
|
|
59
|
+
**Type:** Decision
|
|
60
|
+
**Timestamp:** [Generated Timestamp]
|
|
61
|
+
**NodeID(s):** [Relevant NodeID(s) or 'Project-Wide']
|
|
62
|
+
**Logged By:** Orchestrator (or AI-Agent if relaying)
|
|
63
|
+
**Details:**
|
|
64
|
+
[Record of significant decision made, e.g., "User approved deviation X for NodeID Y.", "Tech stack choice for Z confirmed as ABC."].
|
|
65
|
+
- Rationale: [Brief reason for the decision, if applicable].
|
|
66
|
+
---
|
|
67
|
+
**Type:** Issue
|
|
68
|
+
**Timestamp:** [Generated Timestamp]
|
|
69
|
+
**NodeID(s):** [Relevant NodeID(s) or 'Project-Wide']
|
|
70
|
+
**Logged By:** AI-Agent or Orchestrator
|
|
71
|
+
**Details:**
|
|
72
|
+
An issue has been identified: [Description of the issue].
|
|
73
|
+
- Current Status: [e.g., 'Under Investigation', 'Blocked until X', 'Awaiting user feedback'].
|
|
74
|
+
- Proposed Next Steps: [If any].
|
|
75
|
+
---
|
|
76
|
+
**Type:** RefactorCompletion
|
|
77
|
+
**Timestamp:** [Generated Timestamp]
|
|
78
|
+
**WorkGroupID:** [The WorkGroupID for this refactor]
|
|
79
|
+
**NodeID(s):** [TargetNodeID]
|
|
80
|
+
**Logged By:** AI-Agent
|
|
81
|
+
**Details:**
|
|
82
|
+
Technical debt resolved via refactoring.
|
|
83
|
+
- **Goal:** [Original refactoring goal].
|
|
84
|
+
- **Summary of Improvements:** [List of specific improvements made].
|
|
85
|
+
- **Verification:** Confirmed that all original ARC Verification Criteria still pass.
|
|
86
|
+
---
|
|
87
|
+
**Type:** FeatureAddition
|
|
88
|
+
**Timestamp:** [Generated Timestamp]
|
|
89
|
+
**NodeID(s):** [List ALL new NodeIDs added]
|
|
90
|
+
**Logged By:** AI-Agent
|
|
91
|
+
**Details:**
|
|
92
|
+
Major new feature added mid-project.
|
|
93
|
+
- **Feature Added:** [Name of the new feature].
|
|
94
|
+
- **Scope Change:** Project scope expanded from [Old Total] to [New Total] nodes.
|
|
95
|
+
- **Architectural Impact:** [Brief description of changes].
|
|
96
|
+
- **Implementation Plan:** [Recommended build order for new nodes].
|
|
97
|
+
---
|
|
98
|
+
**Type:** IssueUpdate
|
|
99
|
+
**Timestamp:** [Generated Timestamp]
|
|
100
|
+
**NodeID(s):** [Affected NodeIDs]
|
|
101
|
+
**Logged By:** AI-Agent
|
|
102
|
+
**Details:**
|
|
103
|
+
Critical issue status change.
|
|
104
|
+
- **Previous Status:** [e.g., 'Under Investigation'].
|
|
105
|
+
- **New Status:** [e.g., 'Resolved', 'Workaround Applied'].
|
|
106
|
+
- **Action Taken:** [Brief description of resolution or change].
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
**(New log entries will be added above the `[NEWEST ENTRIES APPEAR HERE...]` marker following the `---` separator format.)**
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Section 2: Reference Quality Criteria (ARC-Based Verification)
|
|
114
|
+
|
|
115
|
+
**(Instructions for AI Agent: This section is read-only. Refer to these criteria during the "ARC-Based Verification" step (Step 6) and the "ARC-Principle-Based Planning" step (Step 4) as outlined in `knowzcode_loop.md`. Specific project priorities are set in `knowzcode_project.md`.)**
|
|
116
|
+
|
|
117
|
+
### Core Quality Criteria
|
|
118
|
+
1. **Maintainability:** Ease of modification, clarity of code and design, quality of documentation (specs, code comments), low coupling, high cohesion.
|
|
119
|
+
2. **Reliability:** Robustness of error handling, fault tolerance, stability under expected load, data integrity.
|
|
120
|
+
3. **Testability:** Adequacy of unit test coverage (especially for core logic), ease of integration testing, clear separation of concerns enabling testing.
|
|
121
|
+
4. **Performance:** Responsiveness, efficiency in resource utilization (CPU, memory, network) appropriate to project requirements.
|
|
122
|
+
5. **Security:** Resistance to common vulnerabilities (as applicable to project type), secure authentication/authorization, protection of sensitive data, secure handling of inputs.
|
|
123
|
+
|
|
124
|
+
### Structural Criteria
|
|
125
|
+
6. **Readability:** Code clarity, adherence to naming conventions (from `knowzcode_project.md`), consistent formatting, quality and necessity of comments.
|
|
126
|
+
7. **Complexity Management:** Avoidance of overly complex logic (e.g., low cyclomatic/cognitive complexity), manageable size of functions/methods/classes.
|
|
127
|
+
8. **Modularity:** Adherence to Single Responsibility Principle, clear interfaces between components, appropriate use of abstraction.
|
|
128
|
+
9. **Code Duplication (DRY - Don't Repeat Yourself):** Minimization of redundant code through effective use of functions, classes, or modules.
|
|
129
|
+
10. **Standards Compliance:** Adherence to language best practices, project-defined coding standards (from `knowzcode_project.md`), and platform conventions (from `environment_context.md`).
|
|
130
|
+
|
|
131
|
+
### Functional Criteria (Primarily verified via `specs/[NodeID].md` ARC Verification Criteria)
|
|
132
|
+
11. **Completeness:** All specified requirements in `specs/[NodeID].md` are met.
|
|
133
|
+
12. **Correctness:** The implemented functionality behaves as specified in `specs/[NodeID].md` under various conditions.
|
|
134
|
+
13. **Effective Error Handling:** As defined in specs, errors are handled gracefully, appropriate feedback is provided, and the system remains stable.
|
|
135
|
+
14. **Dependency Management:** Correct versions of libraries (from `knowzcode_project.md`) are used; unnecessary dependencies are avoided.
|
|
136
|
+
|
|
137
|
+
### Operational Criteria
|
|
138
|
+
15. **Configuration Management:** Proper use of environment variables for sensitive data; configurations are clear and manageable.
|
|
139
|
+
16. **Resource Usage:** Efficient use of environment resources. Code is written considering the target execution environment.
|
|
140
|
+
17. **API Design (If applicable):** Consistency, usability, and clear contracts for any APIs developed or consumed by the node.
|
|
141
|
+
|
|
142
|
+
*(This list guides the ARC-Based Verification process. The ARC Verification Criteria within each `specs/[NodeID].md` file provide specific, testable points derived from these general principles and the node's requirements.)*
|