@dtt_siye/atool 1.3.1 → 1.5.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 (56) hide show
  1. package/README.md +97 -214
  2. package/README.md.atool-backup.20260410_114701 +299 -0
  3. package/VERSION +1 -1
  4. package/bin/atool.js +55 -9
  5. package/hooks/doc-sync-reminder +4 -4
  6. package/hooks/hooks-cursor.json +20 -0
  7. package/hooks/hooks.json +21 -1
  8. package/hooks/pre-commit +191 -0
  9. package/hooks/prompt-guard +84 -35
  10. package/hooks/session-start +34 -12
  11. package/hooks/task-state-tracker +145 -0
  12. package/install.sh +14 -4
  13. package/lib/common.sh +36 -23
  14. package/lib/compute-importance.sh +73 -0
  15. package/lib/install-cursor.sh +24 -2
  16. package/lib/install-hooks.sh +64 -0
  17. package/lib/install-kiro.sh +26 -2
  18. package/lib/install-skills.sh +5 -2
  19. package/lib/pre-scan.sh +13 -1
  20. package/lib/project-init.sh +28 -9
  21. package/package.json +1 -1
  22. package/skills/agent-audit/SKILL.md +180 -0
  23. package/skills/ai-project-architecture/SKILL.md +33 -534
  24. package/skills/ai-project-architecture/rules/architecture-validation.md +200 -0
  25. package/skills/ai-project-architecture/rules/compliance-check.md +83 -0
  26. package/skills/ai-project-architecture/rules/iron-laws.md +188 -0
  27. package/skills/ai-project-architecture/rules/migration.md +94 -0
  28. package/skills/ai-project-architecture/rules/refactoring.md +91 -0
  29. package/skills/ai-project-architecture/rules/testing.md +249 -0
  30. package/skills/ai-project-architecture/rules/verification.md +111 -0
  31. package/skills/architecture-guard/SKILL.md +164 -0
  32. package/skills/architecture-guard/rules/violation-detection.md +90 -0
  33. package/skills/atool-init/SKILL.md +24 -4
  34. package/skills/ci-feedback/SKILL.md +165 -0
  35. package/skills/project-analyze/SKILL.md +129 -19
  36. package/skills/project-analyze/phases/phase1-setup.md +76 -5
  37. package/skills/project-analyze/phases/phase2-understand.md +137 -26
  38. package/skills/project-analyze/phases/phase2.5-refine.md +32 -23
  39. package/skills/project-analyze/phases/phase3-graph.md +39 -5
  40. package/skills/project-analyze/phases/phase4-synthesize.md +17 -1
  41. package/skills/project-analyze/phases/phase5-export.md +42 -4
  42. package/skills/project-analyze/prompts/understand-agent.md +156 -298
  43. package/skills/project-analyze/rules/java.md +69 -1
  44. package/skills/project-query/SKILL.md +91 -200
  45. package/skills/project-query/rules/aggregate-stats.md +301 -0
  46. package/skills/project-query/rules/data-lineage.md +228 -0
  47. package/skills/project-query/rules/impact-analysis.md +218 -0
  48. package/skills/project-query/rules/neighborhood.md +234 -0
  49. package/skills/project-query/rules/node-lookup.md +97 -0
  50. package/skills/project-query/rules/path-query.md +135 -0
  51. package/skills/software-architecture/SKILL.md +39 -501
  52. package/skills/software-architecture/rules/concurrency-ha.md +346 -0
  53. package/skills/software-architecture/rules/ddd.md +450 -0
  54. package/skills/software-architecture/rules/decision-workflow.md +155 -0
  55. package/skills/software-architecture/rules/deployment.md +508 -0
  56. package/skills/software-architecture/rules/styles.md +232 -0
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: agent-audit
3
+ description: "Use when multiple agents or parallel tasks are running — tracks each agent's modifications, detects file conflicts, and provides audit trail. 在多Agent并行工作时使用 — 追踪每个Agent的修改、检测文件冲突、提供审计记录."
4
+ version: 0.1.0
5
+ category: quality
6
+ ---
7
+
8
+ # Agent Audit — Multi-Agent Modification Tracking
9
+
10
+ Tracks file modifications across multiple AI agents or parallel tasks, detects conflicts, and provides a complete audit trail for coordination.
11
+
12
+ ## When to Use
13
+
14
+ - When using `/smart-dispatch` for parallel agent execution
15
+ - When using `/dispatching-parallel-agents` for independent tasks
16
+ - When using `/subagent-driven-development` for implementation plans
17
+ - After parallel agents complete, before merging results
18
+ - When reviewing what changes each agent made
19
+
20
+ ## How It Works
21
+
22
+ ### Audit Log Format
23
+
24
+ Each agent's modifications are recorded in `.claude/agent-audit.json`:
25
+
26
+ ```json
27
+ {
28
+ "audit_entries": [
29
+ {
30
+ "agent_id": "agent-1",
31
+ "task": "Implement user authentication",
32
+ "started_at": 1712649600,
33
+ "completed_at": 1712649900,
34
+ "files_modified": [
35
+ {
36
+ "path": "src/auth/UserService.java",
37
+ "action": "modified",
38
+ "lines_added": 45,
39
+ "lines_removed": 12,
40
+ "intent": "Add JWT token generation"
41
+ }
42
+ ],
43
+ "files_planned": ["src/auth/UserService.java", "src/auth/AuthController.java"],
44
+ "files_unexpected": [],
45
+ "impact_scope": ["auth", "api"],
46
+ "status": "completed"
47
+ }
48
+ ],
49
+ "conflicts": [],
50
+ "summary": {
51
+ "total_agents": 3,
52
+ "total_files_modified": 8,
53
+ "conflicts_detected": 0
54
+ }
55
+ }
56
+ ```
57
+
58
+ ### Step 1: Agent Registration
59
+
60
+ Before dispatching an agent, register it:
61
+
62
+ ```
63
+ Read: agent-audit.json (or create if not exists)
64
+ Add entry:
65
+ {
66
+ "agent_id": "{agent-N}",
67
+ "task": "{task description}",
68
+ "files_planned": [{list of expected files}],
69
+ "started_at": {timestamp}
70
+ }
71
+ ```
72
+
73
+ ### Step 2: Modification Tracking
74
+
75
+ Each agent should record its modifications. Use git diff or task-state data:
76
+
77
+ ```
78
+ After agent completes:
79
+ git diff --stat HEAD → extract file list and line changes
80
+ Compare with files_planned → flag unexpected files
81
+ Cross-reference with knowledge-graph → compute impact_scope
82
+ ```
83
+
84
+ ### Step 3: Conflict Detection
85
+
86
+ After all agents complete, detect file-level conflicts:
87
+
88
+ ```
89
+ For each pair of agents (A, B):
90
+ overlap = A.files_modified ∩ B.files_modified
91
+ if overlap is not empty:
92
+ CONFLICT: agents A and B both modified: {overlap}
93
+ severity = check if changes are in same lines (git merge-base)
94
+ ```
95
+
96
+ Conflict severity levels:
97
+ - **Critical**: Same file, same lines → merge conflict likely
98
+ - **Warning**: Same file, different sections → manual review needed
99
+ - **Info**: Different files, same module → review for logical consistency
100
+
101
+ ### Step 4: Impact Analysis
102
+
103
+ Using knowledge-graph.json (from project-analyze):
104
+
105
+ ```
106
+ For each agent's modified files:
107
+ 1. Find the module each file belongs to
108
+ 2. Find upstream dependents (who depends on this module)
109
+ 3. Find downstream dependencies (what this module depends on)
110
+ 4. Compute impact scope = module + direct dependents
111
+ ```
112
+
113
+ ### Step 5: Consolidated Audit Report
114
+
115
+ ```
116
+ ## Agent Audit Report
117
+
118
+ ### Execution Summary
119
+ | Agent | Task | Files | Status | Duration |
120
+ |-------|------|-------|--------|----------|
121
+ | agent-1 | User auth | 3 | completed | 5m |
122
+ | agent-2 | Payment API | 4 | completed | 7m |
123
+ | agent-3 | Tests | 5 | completed | 4m |
124
+
125
+ ### File Overlap
126
+ | File | Agent-1 | Agent-2 | Agent-3 |
127
+ |------|---------|---------|---------|
128
+ | src/common/Utils.java | modified | - | modified |
129
+
130
+ ### Conflicts
131
+ | Severity | File | Details |
132
+ |----------|------|---------|
133
+ | Warning | src/common/Utils.java | Both agent-1 and agent-3 modified this file |
134
+
135
+ ### Impact Scope
136
+ | Agent | Modules Affected | Downstream Impact |
137
+ |-------|-----------------|-------------------|
138
+ | agent-1 | auth, api | gateway, frontend |
139
+ | agent-2 | payment, billing | notification, reporting |
140
+
141
+ ### Recommendations
142
+ 1. Review src/common/Utils.java for merge conflicts before integrating
143
+ 2. Run integration tests after merging all agent changes
144
+ 3. Update documentation for auth and payment modules
145
+ ```
146
+
147
+ ## Integration with task-state
148
+
149
+ The agent-audit reads from and writes to `.claude/task-state.json`:
150
+
151
+ ```json
152
+ {
153
+ "active_agents": 3,
154
+ "completed_agents": 2,
155
+ "agent_conflicts": ["src/common/Utils.java"],
156
+ "pending_actions": ["resolve_conflict:Utils.java", "run_integration_tests", "update_docs"]
157
+ }
158
+ ```
159
+
160
+ ## Smart-Dispatch Integration
161
+
162
+ When using `/smart-dispatch`:
163
+
164
+ 1. **Before dispatch**: Register each chunk as an agent entry
165
+ 2. **During execution**: Each agent records its modifications
166
+ 3. **After all complete**: Run conflict detection
167
+ 4. **Review phase**: Present consolidated audit report
168
+ 5. **Integration**: User resolves conflicts, then merge
169
+
170
+ ## Skill 协作
171
+
172
+ | 协作 Skill | 触发条件 | 交互方式 |
173
+ |-----------|---------|---------|
174
+ | smart-dispatch | Parallel execution | 每个chunk注册为agent,完成后审计 |
175
+ | dispatching-parallel-agents | Independent tasks | 跟踪每个后台agent的修改 |
176
+ | subagent-driven-development | Implementation plans | 追踪sub-agent修改范围 |
177
+ | project-analyze | Knowledge-graph available | 使用图谱计算impact scope |
178
+ | architecture-guard | Conflicts detected | 检查冲突是否违反架构约束 |
179
+ | verification-before-completion | After agent merge | 合并后验证整体完整性 |
180
+ | ci-feedback | After merge | 运行集成测试验证 |