antigravity-ai-kit 3.1.0 → 3.2.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.
Files changed (43) hide show
  1. package/.agent/agents/planner.md +205 -62
  2. package/.agent/contexts/plan-quality-log.md +30 -0
  3. package/.agent/engine/loading-rules.json +37 -3
  4. package/.agent/hooks/hooks.json +10 -0
  5. package/.agent/manifest.json +4 -3
  6. package/.agent/skills/plan-validation/SKILL.md +192 -0
  7. package/.agent/skills/plan-writing/SKILL.md +47 -8
  8. package/.agent/skills/plan-writing/domain-enhancers.md +114 -0
  9. package/.agent/skills/plan-writing/plan-retrospective.md +116 -0
  10. package/.agent/skills/plan-writing/plan-schema.md +119 -0
  11. package/.agent/workflows/plan.md +49 -5
  12. package/README.md +66 -67
  13. package/bin/ag-kit.js +26 -5
  14. package/lib/agent-registry.js +17 -3
  15. package/lib/agent-reputation.js +3 -11
  16. package/lib/circuit-breaker.js +195 -0
  17. package/lib/cli-commands.js +88 -1
  18. package/lib/config-validator.js +274 -0
  19. package/lib/conflict-detector.js +29 -22
  20. package/lib/constants.js +35 -0
  21. package/lib/engineering-manager.js +9 -27
  22. package/lib/error-budget.js +105 -29
  23. package/lib/hook-system.js +8 -4
  24. package/lib/identity.js +22 -27
  25. package/lib/io.js +74 -0
  26. package/lib/loading-engine.js +248 -35
  27. package/lib/logger.js +118 -0
  28. package/lib/marketplace.js +43 -20
  29. package/lib/plugin-system.js +55 -31
  30. package/lib/plugin-verifier.js +197 -0
  31. package/lib/rate-limiter.js +113 -0
  32. package/lib/security-scanner.js +1 -4
  33. package/lib/self-healing.js +58 -24
  34. package/lib/session-manager.js +51 -48
  35. package/lib/skill-sandbox.js +1 -1
  36. package/lib/task-governance.js +10 -11
  37. package/lib/task-model.js +42 -27
  38. package/lib/updater.js +1 -1
  39. package/lib/verify.js +4 -4
  40. package/lib/workflow-engine.js +88 -68
  41. package/lib/workflow-events.js +166 -0
  42. package/lib/workflow-persistence.js +19 -19
  43. package/package.json +2 -2
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  description: Create implementation plan. Invokes planner agent for structured task breakdown.
3
- version: 2.1.0
3
+ version: 2.2.0
4
4
  sdlc-phase: plan
5
5
  agents: [planner]
6
- skills: [plan-writing, brainstorming]
6
+ skills: [plan-writing, brainstorming, plan-validation]
7
7
  commit-types: [docs]
8
8
  ---
9
9
 
@@ -55,14 +55,33 @@ commit-types: [docs]
55
55
  - Note dependencies and integration points
56
56
 
57
57
  3. **Create Plan**
58
- - Break down the task into small, focused steps
58
+ - The loading engine provides `matchedDomains` and `mandatoryRules` — pass these to the planner agent
59
+ - Consult all mandatory rules (security, testing, coding-style, documentation, git-workflow) using the Rule Extraction Algorithm
60
+ - Classify task size: Trivial (1-2 files), Medium (3-10 files), Large (10+ files)
61
+ - Break down the task into right-sized steps with exact file paths (see plan-writing SKILL.md Principle 1)
59
62
  - Assign verification criteria to each step
60
63
  - Order tasks logically (dependencies first)
64
+ - Include cross-cutting concerns (security, testing, documentation) — ALWAYS, for ALL task sizes
65
+ - For Medium/Large tasks: invoke specialist synthesis (security-reviewer, tdd-guide, architect) per the Specialist Invocation Protocol
66
+ - Include domain-specific sections based on `matchedDomains` (see `domain-enhancers.md`)
61
67
  - Identify which agents are needed for multi-domain tasks
62
68
  - Save plan to `docs/PLAN-{task-slug}.md`
63
69
 
70
+ // turbo
71
+ 3.5. **Validate Plan Quality**
72
+ - The planner performs self-validation using the `plan-validation` skill checklist:
73
+ 1. Classify task size from file count and effort estimate
74
+ 2. Schema compliance: verify all required Tier sections are present and populated
75
+ 3. Cross-cutting verification: Security, Testing, Documentation sections are non-empty (or explicit "N/A — [reason]")
76
+ 4. Specificity audit: every implementation step includes a file path
77
+ 5. Score the plan against the rubric in `plan-schema.md`
78
+ 6. Apply domain scoring: +2 bonus per matched domain with enhancer, -2 penalty per missing
79
+ - **Verdict**: Score >= 70% of tier max → PASS (present to user with score)
80
+ - **Revision**: Score < 70% → identify gaps, revise, re-validate (max 2 cycles, then present with warnings)
81
+ - The quality score is displayed alongside the plan for transparency
82
+
64
83
  4. **Present for Approval**
65
- - Show the plan summary to the user
84
+ - Show the plan summary to the user with quality score
66
85
  - Wait for explicit approval before any implementation
67
86
 
68
87
  ---
@@ -122,20 +141,42 @@ Approve to start implementation with `/create` or `/enhance`.
122
141
 
123
142
  **REQUIRED:**
124
143
  - At least 3 clarifying questions before planning
144
+ - Mandatory rule consultation before plan creation
125
145
  - Verification criteria for every task
146
+ - Cross-cutting concerns (security, testing, documentation) in every plan
147
+ - Plan validation against quality schema before presentation
126
148
  - User approval before implementation begins
127
149
  - Plan file saved in `docs/` with dynamic name
128
150
 
129
151
  ---
130
152
 
153
+ ## Post-Implementation Retrospective
154
+
155
+ After the planned task is fully implemented and verified (reaches VERIFY phase), the `plan-complete` hook triggers a retrospective:
156
+
157
+ 1. **Trigger**: Workflow state transitions to VERIFY (or user runs `/retrospective` on a completed plan)
158
+ 2. **Data Source**: Compare `docs/PLAN-{slug}.md` against `git diff --name-only` from plan start
159
+ 3. **Execution**: Run the plan-retrospective protocol (`.agent/skills/plan-writing/plan-retrospective.md`)
160
+ 4. **Output**: Append one row to `.agent/contexts/plan-quality-log.md`
161
+ 5. **Feedback Loop**: Planner reads the quality log at planning time (Step 1, Requirements Analysis) to adjust estimates, predict surprise files, and weight risk categories
162
+
163
+ This is non-blocking (severity: medium, onFailure: log). If skipped, no impact on current work, but future plan accuracy degrades.
164
+
165
+ ---
166
+
131
167
  ## Completion Criteria
132
168
 
133
169
  - [ ] Clarifying questions asked and answered
134
170
  - [ ] Codebase explored for relevant context
135
- - [ ] Plan created with verifiable tasks
171
+ - [ ] Mandatory rules consulted (security, testing, coding-style, documentation)
172
+ - [ ] Plan created with verifiable tasks and exact file paths
173
+ - [ ] Cross-cutting concerns addressed (security, testing, documentation)
174
+ - [ ] Plan validated against quality schema (score >= 70% of tier max)
175
+ - [ ] Domain-specific sections included for all matched domains
136
176
  - [ ] Plan saved to `docs/PLAN-{slug}.md`
137
177
  - [ ] User has reviewed and approved the plan
138
178
  - [ ] After approval: proceed to `/create` or `/enhance` for implementation
179
+ - [ ] After implementation: retrospective logged to `plan-quality-log.md` (via plan-complete hook)
139
180
 
140
181
  ---
141
182
 
@@ -144,4 +185,7 @@ Approve to start implementation with `/create` or `/enhance`.
144
185
  - **Previous**: `/brainstorm` (explore options) · `/quality-gate` (validate approach)
145
186
  - **Next**: `/create` (scaffold new features) · `/enhance` (iterative development)
146
187
  - **Skill**: `.agent/skills/plan-writing/SKILL.md`
188
+ - **Schema**: `.agent/skills/plan-writing/plan-schema.md`
189
+ - **Domains**: `.agent/skills/plan-writing/domain-enhancers.md`
190
+ - **Validation**: `.agent/skills/plan-validation/SKILL.md`
147
191
  - **Agent**: `planner` agent (see `.agent/agents/planner.md`)
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # 🚀 Antigravity AI Kit
2
2
 
3
- ![version](https://img.shields.io/badge/version-3.1.0-blue)
3
+ ![version](https://img.shields.io/badge/version-3.2.0-blue)
4
4
  ![license](https://img.shields.io/badge/license-MIT-green)
5
5
  ![AI Agents](https://img.shields.io/badge/AI%20Agents-19-purple)
6
- ![Skills](https://img.shields.io/badge/Skills-31-orange)
6
+ ![Skills](https://img.shields.io/badge/Skills-32-orange)
7
7
  ![Commands](https://img.shields.io/badge/Commands-31-red)
8
8
  ![Workflows](https://img.shields.io/badge/Workflows-14-teal)
9
- ![Runtime Modules](https://img.shields.io/badge/Runtime%20Modules-21-blueviolet)
10
- ![Tests](https://img.shields.io/badge/Tests-261%20passing-brightgreen)
9
+ ![Runtime Modules](https://img.shields.io/badge/Runtime%20Modules-29-blueviolet)
10
+ ![Tests](https://img.shields.io/badge/Tests-327%20passing-brightgreen)
11
11
  ![Checklists](https://img.shields.io/badge/Checklists-3-yellow)
12
12
 
13
13
  <p align="center">
@@ -15,7 +15,7 @@
15
15
  </p>
16
16
 
17
17
  <p align="center">
18
- Antigravity AI Kit is a <b>Trust-Grade AI development framework</b> with a <b>21-module runtime engine</b>, <b>19 specialized agents</b>, <b>31 commands</b>, <b>31 skills</b>, and <b>14 workflows</b> — all backed by <b>261 tests</b> and governance-first principles.
18
+ Antigravity AI Kit is a <b>Trust-Grade AI development framework</b> with a <b>29-module runtime engine</b>, <b>19 specialized agents</b>, <b>31 commands</b>, <b>32 skills</b>, and <b>14 workflows</b> — all backed by <b>327 tests</b> and governance-first principles.
19
19
  </p>
20
20
 
21
21
  <p align="center">
@@ -38,8 +38,8 @@
38
38
  - [Architecture](#%EF%B8%8F-architecture-overview)
39
39
  - [Agents](#-agents-19)
40
40
  - [Commands](#%EF%B8%8F-commands-31)
41
- - [Skills](#%EF%B8%8F-skills-31)
42
- - [Runtime Engine](#%EF%B8%8F-runtime-engine-21-modules)
41
+ - [Skills](#%EF%B8%8F-skills-32)
42
+ - [Runtime Engine](#%EF%B8%8F-runtime-engine-29-modules)
43
43
  - [Workflows](#-workflows-14)
44
44
  - [Operating Constraints](#%EF%B8%8F-operating-constraints)
45
45
  - [Session Management](#-session-management)
@@ -56,14 +56,14 @@
56
56
  | Feature | Count | Description |
57
57
  | :---------------- | :---- | :--------------------------------------------------------------------- |
58
58
  | 🤖 **AI Agents** | 19 | Specialized roles (Mobile, DevOps, Database, Security, Performance...) |
59
- | 🛠️ **Skills** | 31 | Domain knowledge modules (API, Testing, MCP, Architecture, Docker...) |
59
+ | 🛠️ **Skills** | 32 | Domain knowledge modules (API, Testing, MCP, Architecture, Docker...) |
60
60
  | ⌨️ **Commands** | 31 | Slash commands for every development workflow |
61
61
  | 🔄 **Workflows** | 14 | Process templates (/create, /debug, /deploy, /test...) |
62
- | ⚙️ **Runtime** | 21 | Runtime engine modules (governance, reputation, self-healing...) |
62
+ | ⚙️ **Runtime** | 29 | Runtime engine modules (governance, reputation, self-healing...) |
63
63
  | ✅ **Checklists** | 3 | Quality gates (session-start, session-end, pre-commit) |
64
64
  | ⚖️ **Rules** | 8 | Modular governance constraints (coding, security, testing, git, docs, sprint) |
65
- | 🔗 **Hooks** | 6 | Event-driven automation (runtime + git-hook enforcement) |
66
- | 🧪 **Tests** | 261 | Unit, structural, and security tests (25 test files) |
65
+ | 🔗 **Hooks** | 7 | Event-driven automation (runtime + git-hook enforcement) |
66
+ | 🧪 **Tests** | 327 | Unit, structural, integration, and security tests (32 test files) |
67
67
 
68
68
  ---
69
69
 
@@ -71,7 +71,7 @@
71
71
 
72
72
  - **🔒 Trust-Grade Governance**: `/explore → /plan → /work → /review` — Each iteration builds context
73
73
  - **🤖 Multi-Agent System**: 19 specialized agents that collaborate (Mobile Developer, DevOps, Database Architect, Sprint Orchestrator...)
74
- - **⚙️ Runtime Engine**: 21 modules enforcing workflow transitions, task governance, agent reputation, self-healing, and marketplace
74
+ - **⚙️ Runtime Engine**: 29 modules enforcing workflow transitions, task governance, agent reputation, self-healing, and marketplace
75
75
  - **📦 Context as Artifact**: Persistent markdown files for plans, specs, and decisions
76
76
  - **🔄 Continuous Learning**: PAAL cycle extracts patterns from every session
77
77
  - **🛡️ Security First**: Built-in secret detection, vulnerability scanning, and compliance checks
@@ -128,47 +128,45 @@ ag-kit scan # Security scan
128
128
 
129
129
  ## 🏗️ Architecture Overview
130
130
 
131
- ```mermaid
132
- graph TB
133
- subgraph "User Interface Layer"
134
- CMD["Slash Commands<br/>31 commands"]
135
- WF["Workflows<br/>14 templates"]
136
- end
137
-
138
- subgraph "Intelligence Layer"
139
- IR[Intelligent Router]
140
- WS[Workflow State Machine]
141
- CB[Context Budget Engine]
142
- LR[Loading Rules]
143
- end
144
-
145
- subgraph "Agent Layer"
146
- CORE["Core Agents<br/>Planner, Architect, Reviewer"]
147
- DOMAIN["Domain Agents<br/>Mobile, Frontend, Backend, DB, DevOps"]
148
- SUPPORT["Support Agents<br/>Security, Perf, Docs, Explorer"]
149
- AUTO["Autonomy Agents<br/>Sprint Orchestrator, Reliability Engineer"]
150
- end
151
-
152
- subgraph "Skill Layer"
153
- ORCH["Orchestration Skills<br/>Routing, Parallel, Modes"]
154
- OPER["Operational Skills<br/>Verification, Learning, Budget"]
155
- DOM["Domain Skills<br/>API, Arch, Testing, Security, MCP"]
156
- end
157
-
158
- subgraph "Governance Layer"
159
- RULES["rules.md<br/>Immutable Constraints"]
160
- HOOKS["hooks.json<br/>6 Event Hooks"]
161
- MANIFEST["manifest.json<br/>Integrity Verification"]
162
- end
163
-
164
- CMD --> IR
165
- WF --> WS
166
- IR --> CORE & DOMAIN & SUPPORT & AUTO
167
- WS --> IR
168
- CB --> LR
169
- LR --> IR
170
- CORE & DOMAIN & SUPPORT & AUTO --> ORCH & OPER & DOM
171
- ORCH & OPER & DOM --> RULES & HOOKS & MANIFEST
131
+ ```
132
+ ┌─────────────────────────────────────────────────────────────────────┐
133
+ │ USER INTERFACE LAYER │
134
+ │ ┌─────────────────────────┐ ┌─────────────────────────┐ │
135
+ │ │ Slash Commands (31) │ │ Workflows (14) │ │
136
+ │ └────────────┬────────────┘ └────────────┬────────────┘ │
137
+ ├───────────────┼────────────────────────────┼────────────────────────┤
138
+ │ ▼ INTELLIGENCE LAYER ▼ │
139
+ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
140
+ │ │ Intelligent │ │ Workflow State │ │ Context Budget │ │
141
+ │ │ Router │ │ Machine │ │ Engine │ │
142
+ │ └────────┬─────────┘ └──────────────────┘ └──────────────────┘ │
143
+ ├───────────┼────────────────────────────────────────────────────────-┤
144
+ │ ▼ AGENT LAYER (19) │
145
+ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
146
+ │ │ Core Agents │ │ Domain Agents │ │ Support Agents │ │
147
+ │ │ Planner │ │ Mobile Dev │ │ Security │ │
148
+ │ │ Architect │ │ Frontend │ │ Performance │ │
149
+ │ │ Code Reviewer │ │ Backend │ │ Docs, Explorer │ │
150
+ │ │ TDD Specialist │ │ DB, DevOps │ │ Knowledge │ │
151
+ │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
152
+ ├───────────┼─────────────────────┼─────────────────────┼────────────┤
153
+ │ ▼ SKILL LAYER (32) ▼ │
154
+ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
155
+ │ │ Orchestration │ │ Operational │ │ Domain Skills │ │
156
+ │ │ Routing, Modes │ │ Verification │ │ API, Testing │ │
157
+ │ │ Parallel Agents │ │ Learning, Budget │ │ Security, MCP │ │
158
+ │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
159
+ ├───────────┼─────────────────────┼─────────────────────┼────────────┤
160
+ │ ▼ GOVERNANCE LAYER ▼ │
161
+ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
162
+ │ │ rules/ (8) │ │ hooks.json │ │ manifest.json │ │
163
+ │ │ Governance │ │ 7 Event Hooks │ │ Integrity Check │ │
164
+ │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
165
+ ├─────────────────────────────────────────────────────────────────────┤
166
+ │ RUNTIME ENGINE (29 modules) │
167
+ │ workflow-engine · session-manager · task-governance │
168
+ │ agent-reputation · self-healing · marketplace · + 15 more │
169
+ └─────────────────────────────────────────────────────────────────────┘
172
170
  ```
173
171
 
174
172
  ### How It Works: The Autonomy Engine
@@ -188,7 +186,7 @@ EXPLORE → PLAN → IMPLEMENT → VERIFY → REVIEW → DEPLOY
188
186
  | **REVIEW** | Code review (human or Copilot) | Review approved |
189
187
  | **DEPLOY** | Production deployment | Deployment checklist complete |
190
188
 
191
- **Intelligent Routing**: The kit analyzes your request keywords and automatically loads the right agents and skills (max 4 agents + 6 skills per session to stay within context budgets).
189
+ **Intelligent Routing**: The kit analyzes your request keywords (including implicit security triggers like "login", "payment", "upload") and automatically loads the right agents and skills (max 4 agents + 8 skills per session to stay within context budgets). Planning workflows use protected budget enforcement — mandatory skills survive trimming even when over budget.
192
190
 
193
191
  ---
194
192
 
@@ -228,7 +226,7 @@ EXPLORE → PLAN → IMPLEMENT → VERIFY → REVIEW → DEPLOY
228
226
 
229
227
  | Agent | Role | Triggers |
230
228
  | :----------------------- | :-------------------------------- | :---------------------------- |
231
- | **Planner** | Task breakdown, Socratic analysis | plan, breakdown, requirements |
229
+ | **Planner** | Multi-agent plan synthesis, tiered quality schema, specialist coordination | plan, breakdown, requirements |
232
230
  | **Sprint Orchestrator** | Sprint planning, velocity | sprint, roadmap, velocity |
233
231
  | **Reliability Engineer** | SRE, production readiness | reliability, SLA, monitoring |
234
232
 
@@ -304,7 +302,7 @@ EXPLORE → PLAN → IMPLEMENT → VERIFY → REVIEW → DEPLOY
304
302
 
305
303
  ---
306
304
 
307
- ## 🛠️ Skills (31)
305
+ ## 🛠️ Skills (32)
308
306
 
309
307
  ### Operational Skills (5)
310
308
 
@@ -343,7 +341,7 @@ EXPLORE → PLAN → IMPLEMENT → VERIFY → REVIEW → DEPLOY
343
341
  | `git-workflow` | Branching, commits |
344
342
  | `i18n-localization` | Internationalization patterns |
345
343
 
346
- ### Development Skills (9)
344
+ ### Development Skills (10)
347
345
 
348
346
  | Skill | Purpose |
349
347
  | :---------------------- | :---------------------- |
@@ -353,15 +351,16 @@ EXPLORE → PLAN → IMPLEMENT → VERIFY → REVIEW → DEPLOY
353
351
  | `deployment-procedures` | CI/CD, rollback |
354
352
  | `performance-profiling` | Core Web Vitals |
355
353
  | `brainstorming` | Socratic discovery |
356
- | `plan-writing` | Structured planning |
354
+ | `plan-writing` | Structured planning with tiered quality schema |
355
+ | `plan-validation` | Quality gate with completeness scoring |
357
356
  | `shell-conventions` | PowerShell/Bash conventions |
358
357
  | `ui-ux-pro-max` | Premium UI/UX design system |
359
358
 
360
359
  ---
361
360
 
362
- ## ⚙️ Runtime Engine (21 Modules)
361
+ ## ⚙️ Runtime Engine (29 Modules)
363
362
 
364
- Antigravity AI Kit v3.1.0 includes a **full runtime engine** built across 4 phases — all using Node.js built-ins with zero external dependencies.
363
+ Antigravity AI Kit v3.2.0 includes a **full runtime engine** built across 4 phases — all using Node.js built-ins with zero external dependencies.
365
364
 
366
365
  ### Phase 1 — Foundation Hardening
367
366
 
@@ -379,7 +378,7 @@ Antigravity AI Kit v3.1.0 includes a **full runtime engine** built across 4 phas
379
378
  |:---|:---|
380
379
  | `workflow-persistence` | Persistent state + checkpoints |
381
380
  | `agent-registry` | Agent contract validation |
382
- | `loading-engine` | Keyword matching + context budget |
381
+ | `loading-engine` | Keyword matching + implicit triggers + context budget |
383
382
  | `hook-system` | Event-driven lifecycle hooks |
384
383
  | `task-model` | Task CRUD with status tracking |
385
384
 
@@ -616,16 +615,16 @@ antigravity-ai-kit/
616
615
  ├── .agent/ # Core AI Kit
617
616
  │ ├── agents/ # 19 specialized agents
618
617
  │ ├── commands/ # 31 slash commands
619
- │ ├── skills/ # 31 capability modules
618
+ │ ├── skills/ # 32 capability modules
620
619
  │ ├── workflows/ # 14 process templates
621
620
  │ ├── engine/ # Autonomy Engine (state machine, loading rules, configs)
622
- │ ├── hooks/ # 6 event hooks (runtime + git-hook)
621
+ │ ├── hooks/ # 7 event hooks (runtime + git-hook)
623
622
  │ ├── rules/ # 8 modular governance rules
624
623
  │ ├── checklists/ # Verification checklists (3)
625
624
  │ ├── templates/ # ADR, feature-request, bug-report templates
626
625
  │ ├── decisions/ # Architecture Decision Records
627
626
  │ └── manifest.json # Machine-readable capability registry
628
- ├── lib/ # Runtime Engine (21 modules)
627
+ ├── lib/ # Runtime Engine (29 modules)
629
628
  │ ├── workflow-engine.js # State machine enforcement
630
629
  │ ├── task-governance.js # Locking, audit trail, decision timeline
631
630
  │ ├── agent-reputation.js # Score tracking & rankings
@@ -634,8 +633,8 @@ antigravity-ai-kit/
634
633
  │ └── + 16 more modules # Identity, plugins, hooks, registry...
635
634
  ├── bin/ # CLI (ag-kit)
636
635
  ├── create-antigravity-app/ # Project scaffolder (separate npm package)
637
- ├── tests/ # Test suites (261 tests, 25 files)
638
- │ ├── unit/ # 21 module tests
636
+ ├── tests/ # Test suites (327 tests, 32 files)
637
+ │ ├── unit/ # Module tests (loading-engine, self-healing, plugins...)
639
638
  │ ├── structural/ # Inventory + schema validation
640
639
  │ └── security/ # Injection scan + leakage detection
641
640
  ├── docs/ # MkDocs documentation site
@@ -712,7 +711,7 @@ Want to use Antigravity AI Kit in your project? The **[Contributor Guide](https:
712
711
  - Context-driven development from [Google Conductor](https://developers.googleblog.com/en/conductor-introducing-context-driven-development-for-gemini-cli/)
713
712
  - Hook concepts from [everything-claude-code](https://github.com/affaan-m/everything-claude-code)
714
713
 
715
- _Antigravity AI Kit v3.1.0 extends these foundations with a 21-module runtime engine, Trust-Grade governance, session management, and 100+ capabilities._
714
+ _Antigravity AI Kit v3.2.0 extends these foundations with a 29-module runtime engine, Trust-Grade governance, session management, and 100+ capabilities._
716
715
 
717
716
  ---
718
717
 
package/bin/ag-kit.js CHANGED
@@ -14,7 +14,7 @@
14
14
  const fs = require('fs');
15
15
  const path = require('path');
16
16
 
17
- const VERSION = '3.0.0';
17
+ const VERSION = require('../package.json').version;
18
18
  const AGENT_FOLDER = '.agent';
19
19
 
20
20
  // ANSI colors
@@ -71,6 +71,7 @@ ${colors.bright}Usage:${colors.reset}
71
71
  ag-kit market info <name> Get marketplace plugin details
72
72
  ag-kit market install <n> Install from marketplace
73
73
  ag-kit heal [--file <f>] Detect and diagnose CI failures
74
+ ag-kit health Run aggregated health check
74
75
  ag-kit --help Show this help message
75
76
  ag-kit --version Show version
76
77
 
@@ -524,16 +525,28 @@ const options = {
524
525
  file: null,
525
526
  };
526
527
 
527
- // Parse --path option
528
+ // Parse --path option with traversal protection (H-7: use path.resolve boundary check)
528
529
  const pathIndex = args.indexOf('--path');
529
530
  if (pathIndex !== -1 && args[pathIndex + 1]) {
530
- options.path = args[pathIndex + 1];
531
+ const resolvedPath = path.resolve(args[pathIndex + 1]);
532
+ const cwd = process.cwd();
533
+ if (!resolvedPath.startsWith(cwd + path.sep) && resolvedPath !== cwd) {
534
+ log('Error: --path must resolve within current working directory', 'red');
535
+ process.exit(1);
536
+ }
537
+ options.path = resolvedPath;
531
538
  }
532
539
 
533
- // Parse --file option
540
+ // Parse --file option with traversal protection (H-7: use path.resolve boundary check)
534
541
  const fileIndex = args.indexOf('--file');
535
542
  if (fileIndex !== -1 && args[fileIndex + 1]) {
536
- options.file = args[fileIndex + 1];
543
+ const resolvedFile = path.resolve(args[fileIndex + 1]);
544
+ const cwdForFile = process.cwd();
545
+ if (!resolvedFile.startsWith(cwdForFile + path.sep) && resolvedFile !== cwdForFile) {
546
+ log('Error: --file must resolve within current working directory', 'red');
547
+ process.exit(1);
548
+ }
549
+ options.file = resolvedFile;
537
550
  }
538
551
 
539
552
  // Execute command
@@ -567,6 +580,14 @@ switch (command) {
567
580
  cliCmd.healCommand(process.cwd(), { file: options.file, apply: options.apply });
568
581
  break;
569
582
  }
583
+ case 'health': {
584
+ const cliHealth = require('../lib/cli-commands');
585
+ const result = cliHealth.healthCommand(process.cwd());
586
+ if (!result.healthy) {
587
+ process.exit(1);
588
+ }
589
+ break;
590
+ }
570
591
  case '--version':
571
592
  case '-v':
572
593
  console.log(VERSION);
@@ -14,7 +14,7 @@
14
14
  const fs = require('fs');
15
15
  const path = require('path');
16
16
 
17
- const AGENT_DIR = '.agent';
17
+ const { AGENT_DIR } = require('./constants');
18
18
  const AGENTS_SUBDIR = 'agents';
19
19
  const MANIFEST_FILE = 'manifest.json';
20
20
 
@@ -153,7 +153,14 @@ function validateAgent(agentName, projectRoot) {
153
153
  */
154
154
  function validateAllAgents(projectRoot) {
155
155
  const manifestPath = path.join(projectRoot, AGENT_DIR, MANIFEST_FILE);
156
- const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
156
+
157
+ let manifest;
158
+ try {
159
+ manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
160
+ } catch {
161
+ return { total: 0, valid: 0, invalid: 0, agents: [] };
162
+ }
163
+
157
164
  const agents = manifest.capabilities?.agents?.items || [];
158
165
 
159
166
  const results = agents.map((agent) => validateAgent(agent.name, projectRoot));
@@ -175,7 +182,14 @@ function validateAllAgents(projectRoot) {
175
182
  */
176
183
  function loadRegistry(projectRoot) {
177
184
  const manifestPath = path.join(projectRoot, AGENT_DIR, MANIFEST_FILE);
178
- const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
185
+
186
+ let manifest;
187
+ try {
188
+ manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
189
+ } catch {
190
+ return { agents: [], totalCount: 0 };
191
+ }
192
+
179
193
  const agents = manifest.capabilities?.agents?.items || [];
180
194
 
181
195
  return {
@@ -15,8 +15,8 @@ const fs = require('fs');
15
15
  const path = require('path');
16
16
  const crypto = require('crypto');
17
17
 
18
- const AGENT_DIR = '.agent';
19
- const ENGINE_DIR = 'engine';
18
+ const { AGENT_DIR, ENGINE_DIR } = require('./constants');
19
+ const { writeJsonAtomic } = require('./io');
20
20
  const REPUTATION_FILE = 'reputation.json';
21
21
 
22
22
  /** Score bounds */
@@ -95,15 +95,7 @@ function loadReputationData(projectRoot) {
95
95
  */
96
96
  function writeReputationData(projectRoot, data) {
97
97
  const filePath = resolveReputationPath(projectRoot);
98
- const dir = path.dirname(filePath);
99
-
100
- if (!fs.existsSync(dir)) {
101
- fs.mkdirSync(dir, { recursive: true });
102
- }
103
-
104
- const tempPath = `${filePath}.tmp`;
105
- fs.writeFileSync(tempPath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
106
- fs.renameSync(tempPath, filePath);
98
+ writeJsonAtomic(filePath, data);
107
99
  }
108
100
 
109
101
  /**