@moon791017/neo-skills 1.1.24 → 1.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moon791017/neo-skills",
3
- "version": "1.1.24",
3
+ "version": "1.1.25",
4
4
  "type": "module",
5
5
  "description": "Neo Skills: A Universal AI Agent Skills Extension",
6
6
  "homepage": "https://neo-blog-iota.vercel.app/",
@@ -25,7 +25,8 @@ Agent = Model (Reasoning & Generation) + Harness (Guides + Sensors + Gates + Top
25
25
  The generated `AGENTS.md` acts as the single source of truth governing all AI Agents operating in the project.
26
26
 
27
27
  > [!IMPORTANT]
28
- > **Size Constraint**: The generated `AGENTS.md` MUST NOT exceed 32 KiB (32,768 bytes) to prevent token pollution in session context windows.
28
+ > **Template Compliance & Size Constraint**:
29
+ > Any created or modified `AGENTS.md` MUST strictly adhere to the design specification of [`assets/AGENTS.md.template`](assets/AGENTS.md.template) (containing 4 mandatory sections: Project Overview, Commands Table, 9-stage Workflow Mermaid loop, and Forbidden Antipattern Redlines Table) and MUST NOT exceed 32 KiB (32,768 bytes).
29
30
 
30
31
  ---
31
32
 
@@ -39,6 +40,9 @@ python3 skills/neo-harness/scripts/generate-agents-md.py --target-dir /path/to/r
39
40
 
40
41
  # Generate AGENTS.md directly in target repository
41
42
  python3 skills/neo-harness/scripts/generate-agents-md.py --target-dir /path/to/repo --force
43
+
44
+ # Validate existing AGENTS.md against assets/AGENTS.md.template design specification
45
+ python3 skills/neo-harness/scripts/generate-agents-md.py --target-dir /path/to/repo --validate
42
46
  ```
43
47
 
44
48
  ---
@@ -59,17 +63,18 @@ Load detailed reference knowledge as needed:
59
63
  * **Execution Protocol & SOP**: Read [references/execution-protocol.md](references/execution-protocol.md) to enforce the 5 Harness Laws, dual-loop SOP, zero-fake pass, and antipattern rules.
60
64
  * **Orchestration Topologies**: Read [references/orchestration-patterns.md](references/orchestration-patterns.md) to select appropriate routing, chaining, or human-in-the-loop (HITL) gates.
61
65
 
62
- ### Step 3 — Generate `AGENTS.md`
63
- Use `scripts/generate-agents-md.py` or [assets/AGENTS.md.template](assets/AGENTS.md.template) as the baseline template. Populate it with discovered project facts:
64
- 1. **Feedforward Guides**: Exact coding styles, module boundaries, and domain conventions.
65
- 2. **Deterministic Feedback Sensors**: Exact one-click test/lint/build commands.
66
- 3. **The 5 Agent Harness Laws**: Mandatory execution principles.
67
- 4. **Dual Closed-Loop Execution SOP**: Perceive ➔ Execute ➔ Sense ➔ Remediate.
68
- 5. **Forbidden Antipatterns**: Strict redlines (no silent exception swallowing, no test deletion, no hallucinated signatures).
69
- 6. **Human Decision Points & Safety Redlines**: Explicit boundaries requiring human approval.
70
-
71
- ### Step 4 — Verify Size & Quality Gate
72
- 1. Check the file size of the generated `AGENTS.md`:
66
+ ### Step 3 — Generate & Format `AGENTS.md`
67
+ Use `scripts/generate-agents-md.py` with [assets/AGENTS.md.template](assets/AGENTS.md.template) as the strict baseline template.
68
+ All created or modified `AGENTS.md` files MUST strictly contain the following 4 structural sections in order:
69
+ 1. **`## 1. Project Overview`**: Primary tech stack, modular architecture, and coding conventions.
70
+ 2. **`## 2. Commands`**: Standard markdown table (`Command Type`, `Exact Command Line`, `Purpose / Scope`) listing test, typecheck, lint, build, or syntax check commands.
71
+ 3. **`## 3. Workflow`**: The mandatory 9-stage closed loop Mermaid diagram (`graph TD` from Step1 to Step9) followed by the 9 numbered step definitions.
72
+ 4. **`## 4. Forbidden Antipattern Redlines`**: Standard markdown table (`Forbidden Action`, `Why It Is Prohibited`, `Required Behavior`) specifying non-negotiable redlines.
73
+
74
+ ### Step 4 — Verify Template Compliance & Quality Gate
75
+ 1. Validate structural compliance against `assets/AGENTS.md.template`:
76
+ - Run `python3 skills/neo-harness/scripts/generate-agents-md.py --target-dir /path/to/repo --validate`.
77
+ 2. Check the file size of the generated `AGENTS.md`:
73
78
  - Must be `<= 32,768 bytes`.
74
79
  - If over 32 KiB, prune redundant descriptions or move extended reference docs to separate files under `.agents/` or `docs/`.
75
- 2. Validate syntax and formatting.
80
+ 3. Validate syntax and markdown formatting.
@@ -45,3 +45,20 @@ Immediately pause and request human intervention when encountering:
45
45
  2. Identify the exact file line number and root cause exception message.
46
46
  3. Formulate a targeted fix addressing the root cause, not just masking the symptom.
47
47
  4. Re-run verification commands to confirm the fix works cleanly.
48
+
49
+ ---
50
+
51
+ ## AGENTS.md Template Specification Gate
52
+
53
+ All created or updated `AGENTS.md` files MUST comply with the design specification of `assets/AGENTS.md.template`:
54
+
55
+ 1. **Mandatory Sections**:
56
+ - Section 1: `## 1. Project Overview` (Tech stack, architecture, modularity)
57
+ - Section 2: `## 2. Commands` (3-column markdown table: `Command Type`, `Exact Command Line`, `Purpose / Scope`)
58
+ - Section 3: `## 3. Workflow` (9-stage closed loop Mermaid diagram `graph TD` and 9 numbered steps)
59
+ - Section 4: `## 4. Forbidden Antipattern Redlines` (3-column markdown table: `Forbidden Action`, `Why It Is Prohibited`, `Required Behavior`)
60
+ 2. **File Size Limit**:
61
+ - Strictly `<= 32,768 bytes` (32 KiB).
62
+ 3. **Automated Validation**:
63
+ - Run `python3 skills/neo-harness/scripts/generate-agents-md.py --target-dir <repo-path> --validate`.
64
+
@@ -202,9 +202,51 @@ def enforce_size_limit(content: str) -> str:
202
202
  return pruned_content
203
203
 
204
204
 
205
+ def validate_agents_md_structure(content: str) -> list[str]:
206
+ """
207
+ Validate content against assets/AGENTS.md.template structural requirements.
208
+ Returns a list of error validation messages (empty list if compliant).
209
+ """
210
+ errors = []
211
+
212
+ # 1. Size limit check
213
+ byte_size = len(content.encode("utf-8"))
214
+ if byte_size > MAX_BYTES:
215
+ errors.append(f"File size ({byte_size} bytes) exceeds maximum limit of 32 KiB ({MAX_BYTES} bytes).")
216
+
217
+ # 2. Section 1 check
218
+ if "## 1. Project Overview" not in content:
219
+ errors.append("Missing required section: '## 1. Project Overview'")
220
+
221
+ # 3. Section 2 check
222
+ if "## 2. Commands" not in content:
223
+ errors.append("Missing required section: '## 2. Commands'")
224
+ else:
225
+ if "| Command Type | Exact Command Line | Purpose / Scope |" not in content:
226
+ errors.append("Section 2 missing required table header: '| Command Type | Exact Command Line | Purpose / Scope |'")
227
+
228
+ # 4. Section 3 check
229
+ if "## 3. Workflow" not in content:
230
+ errors.append("Missing required section: '## 3. Workflow'")
231
+ else:
232
+ if "```mermaid" not in content or "graph TD" not in content:
233
+ errors.append("Section 3 missing required Mermaid diagram ('```mermaid' with 'graph TD').")
234
+ if "1. **Perceive Task**" not in content or "9. **Handoff upon Pass**" not in content:
235
+ errors.append("Section 3 missing standard 9-stage closed loop workflow steps.")
236
+
237
+ # 5. Section 4 check
238
+ if "## 4. Forbidden Antipattern Redlines" not in content:
239
+ errors.append("Missing required section: '## 4. Forbidden Antipattern Redlines'")
240
+ else:
241
+ if "| Forbidden Action | Why It Is Prohibited | Required Behavior |" not in content:
242
+ errors.append("Section 4 missing required table header: '| Forbidden Action | Why It Is Prohibited | Required Behavior |'")
243
+
244
+ return errors
245
+
246
+
205
247
  def main():
206
248
  parser = argparse.ArgumentParser(
207
- description="Non-interactive AGENTS.md generator for neo-harness."
249
+ description="Non-interactive AGENTS.md generator and validator for neo-harness."
208
250
  )
209
251
  parser.add_argument(
210
252
  "--target-dir",
@@ -228,6 +270,11 @@ def main():
228
270
  action="store_true",
229
271
  help="Overwrite output file if it already exists",
230
272
  )
273
+ parser.add_argument(
274
+ "--validate",
275
+ action="store_true",
276
+ help="Validate target AGENTS.md against AGENTS.md.template design specification",
277
+ )
231
278
 
232
279
  args = parser.parse_args()
233
280
 
@@ -238,6 +285,25 @@ def main():
238
285
 
239
286
  output_path = Path(args.output) if args.output else target_dir / "AGENTS.md"
240
287
 
288
+ if args.validate:
289
+ if not output_path.exists():
290
+ log_diag(f"Validation Error: Target file '{output_path}' does not exist.")
291
+ sys.exit(1)
292
+
293
+ log_diag(f"Validating AGENTS.md file: {output_path}")
294
+ with open(output_path, "r", encoding="utf-8") as f:
295
+ target_content = f.read()
296
+
297
+ val_errors = validate_agents_md_structure(target_content)
298
+ if val_errors:
299
+ log_diag("AGENTS.md Template Validation Failed:")
300
+ for err in val_errors:
301
+ log_diag(f" - {err}")
302
+ sys.exit(1)
303
+ else:
304
+ log_diag(f"AGENTS.md Template Validation Passed for '{output_path}'.")
305
+ sys.exit(0)
306
+
241
307
  log_diag(f"Scanning target directory: {target_dir}")
242
308
  facts = detect_project_facts(target_dir)
243
309
  log_diag(f"Detected project name: {facts['project_name']}, tech stack: {facts['tech_stack']}")
@@ -245,6 +311,12 @@ def main():
245
311
  content = generate_agents_md_content(facts)
246
312
  content = enforce_size_limit(content)
247
313
 
314
+ val_errors = validate_agents_md_structure(content)
315
+ if val_errors:
316
+ log_diag("Warning: Generated AGENTS.md failed template validation:")
317
+ for err in val_errors:
318
+ log_diag(f" - {err}")
319
+
248
320
  byte_size = len(content.encode("utf-8"))
249
321
  log_diag(f"Generated AGENTS.md size: {byte_size} bytes ({byte_size/1024:.2f} KiB)")
250
322
 
@@ -264,3 +336,4 @@ def main():
264
336
 
265
337
  if __name__ == "__main__":
266
338
  main()
339
+