@defai.digital/automatosx 5.0.13 → 5.1.2
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/CHANGELOG.md +110 -0
- package/README.md +310 -92
- package/dist/index.js +7784 -6097
- package/dist/index.js.map +1 -1
- package/dist/version.json +3 -3
- package/examples/AGENTS_INFO.md +495 -0
- package/examples/README.md +434 -0
- package/examples/abilities/accessibility.md +115 -0
- package/examples/abilities/api-design.md +159 -0
- package/examples/abilities/best-practices.md +102 -0
- package/examples/abilities/caching-strategy.md +165 -0
- package/examples/abilities/ci-cd.md +61 -0
- package/examples/abilities/code-generation.md +95 -0
- package/examples/abilities/code-review.md +42 -0
- package/examples/abilities/component-architecture.md +112 -0
- package/examples/abilities/content-creation.md +97 -0
- package/examples/abilities/data-modeling.md +171 -0
- package/examples/abilities/data-validation.md +50 -0
- package/examples/abilities/db-modeling.md +158 -0
- package/examples/abilities/debugging.md +43 -0
- package/examples/abilities/dependency-audit.md +60 -0
- package/examples/abilities/design-system-implementation.md +126 -0
- package/examples/abilities/documentation.md +54 -0
- package/examples/abilities/error-analysis.md +107 -0
- package/examples/abilities/etl-pipelines.md +44 -0
- package/examples/abilities/feasibility-study.md +20 -0
- package/examples/abilities/general-assistance.md +26 -0
- package/examples/abilities/idea-evaluation.md +21 -0
- package/examples/abilities/infra-as-code.md +57 -0
- package/examples/abilities/job-orchestration.md +44 -0
- package/examples/abilities/literature-review.md +19 -0
- package/examples/abilities/logical-analysis.md +21 -0
- package/examples/abilities/longform-report.md +25 -0
- package/examples/abilities/observability.md +61 -0
- package/examples/abilities/our-architecture-decisions.md +180 -0
- package/examples/abilities/our-code-review-checklist.md +149 -0
- package/examples/abilities/our-coding-standards.md +270 -0
- package/examples/abilities/our-project-structure.md +175 -0
- package/examples/abilities/performance-analysis.md +56 -0
- package/examples/abilities/performance.md +80 -0
- package/examples/abilities/problem-solving.md +50 -0
- package/examples/abilities/refactoring.md +49 -0
- package/examples/abilities/release-strategy.md +58 -0
- package/examples/abilities/risk-assessment.md +19 -0
- package/examples/abilities/secrets-policy.md +61 -0
- package/examples/abilities/secure-coding-review.md +51 -0
- package/examples/abilities/security-audit.md +65 -0
- package/examples/abilities/sql-optimization.md +84 -0
- package/examples/abilities/state-management.md +96 -0
- package/examples/abilities/task-planning.md +65 -0
- package/examples/abilities/technical-writing.md +77 -0
- package/examples/abilities/testing.md +47 -0
- package/examples/abilities/threat-modeling.md +49 -0
- package/examples/abilities/troubleshooting.md +80 -0
- package/examples/agents/.tmp +0 -0
- package/examples/agents/backend.yaml +69 -0
- package/examples/agents/ceo.yaml +60 -0
- package/examples/agents/cto.yaml +59 -0
- package/examples/agents/data.yaml +77 -0
- package/examples/agents/design.yaml +73 -0
- package/examples/agents/devops.yaml +82 -0
- package/examples/agents/frontend.yaml +74 -0
- package/examples/agents/product.yaml +69 -0
- package/examples/agents/quality.yaml +70 -0
- package/examples/agents/researcher.yaml +71 -0
- package/examples/agents/security.yaml +84 -0
- package/examples/agents/writer.yaml +77 -0
- package/examples/claude/commands/ax:agent.md +37 -0
- package/examples/claude/commands/ax:clear.md +22 -0
- package/examples/claude/commands/ax:init.md +25 -0
- package/examples/claude/commands/ax:list.md +19 -0
- package/examples/claude/commands/ax:memory.md +25 -0
- package/examples/claude/commands/ax:status.md +24 -0
- package/examples/claude/commands/ax:update.md +28 -0
- package/examples/claude/mcp/automatosx.json +244 -0
- package/examples/teams/business.yaml +56 -0
- package/examples/teams/core.yaml +59 -0
- package/examples/teams/design.yaml +58 -0
- package/examples/teams/engineering.yaml +69 -0
- package/examples/teams/research.yaml +56 -0
- package/examples/templates/analyst.yaml +60 -0
- package/examples/templates/assistant.yaml +48 -0
- package/examples/templates/basic-agent.yaml +28 -0
- package/examples/templates/code-reviewer.yaml +52 -0
- package/examples/templates/debugger.yaml +63 -0
- package/examples/templates/designer.yaml +69 -0
- package/examples/templates/developer.yaml +60 -0
- package/examples/templates/fullstack-developer.yaml +395 -0
- package/examples/templates/qa-specialist.yaml +71 -0
- package/examples/use-cases/01-web-app-development.md +374 -0
- package/package.json +2 -1
- package/version.json +3 -3
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Our Code Review Checklist - AutomatosX v5
|
|
2
|
+
|
|
3
|
+
> Code review checklist for AutomatosX team
|
|
4
|
+
|
|
5
|
+
## Before Submitting PR
|
|
6
|
+
|
|
7
|
+
### Code Quality
|
|
8
|
+
|
|
9
|
+
- [ ] **No `any` types** - All types explicit, use `unknown` if truly unknown
|
|
10
|
+
- [ ] **ESM imports** - All imports have `.js` extension
|
|
11
|
+
- [ ] **Function size** - Functions <50 lines, extract helpers if needed
|
|
12
|
+
- [ ] **Naming** - Clear, descriptive names (no abbreviations)
|
|
13
|
+
- [ ] **Comments** - JSDoc for public APIs, inline for complex logic
|
|
14
|
+
|
|
15
|
+
### Error Handling
|
|
16
|
+
|
|
17
|
+
- [ ] **Custom errors** - Use AgentValidationError, PathError, etc.
|
|
18
|
+
- [ ] **Error context** - Include relevant context in error messages
|
|
19
|
+
- [ ] **Try-catch blocks** - Catch and re-throw with context
|
|
20
|
+
- [ ] **No silent failures** - All errors logged or thrown
|
|
21
|
+
|
|
22
|
+
### Security
|
|
23
|
+
|
|
24
|
+
- [ ] **Path validation** - All file access through PathResolver
|
|
25
|
+
- [ ] **Input sanitization** - User inputs sanitized before use
|
|
26
|
+
- [ ] **Workspace isolation** - Writes only to agent workspace
|
|
27
|
+
- [ ] **File size limits** - Check file sizes to prevent DoS
|
|
28
|
+
- [ ] **No hardcoded secrets** - Use environment variables
|
|
29
|
+
|
|
30
|
+
### Testing
|
|
31
|
+
|
|
32
|
+
- [ ] **Tests added** - New features have tests (unit + integration)
|
|
33
|
+
- [ ] **Coverage maintained** - Overall ≥70%, core modules ≥85%
|
|
34
|
+
- [ ] **Tests pass** - All 1,149 tests passing
|
|
35
|
+
- [ ] **Edge cases** - Test edge cases and error scenarios
|
|
36
|
+
|
|
37
|
+
### Performance
|
|
38
|
+
|
|
39
|
+
- [ ] **No bottlenecks** - Profile if adding expensive operations
|
|
40
|
+
- [ ] **Lazy loading** - Heavy deps use dynamic import
|
|
41
|
+
- [ ] **Caching** - Use TTLCache for expensive operations
|
|
42
|
+
- [ ] **Bundle size** - Check `dist/index.js` stays <250KB
|
|
43
|
+
|
|
44
|
+
### Logging
|
|
45
|
+
|
|
46
|
+
- [ ] **Structured logging** - Use `logger.info/warn/error` with context
|
|
47
|
+
- [ ] **Log levels** - Appropriate log levels (debug/info/warn/error)
|
|
48
|
+
- [ ] **No console.log** - Use logger, not console.log
|
|
49
|
+
|
|
50
|
+
### Git
|
|
51
|
+
|
|
52
|
+
- [ ] **Conventional commits** - Format: `type(scope): message`
|
|
53
|
+
- [ ] **Descriptive message** - Clear what and why
|
|
54
|
+
- [ ] **No large files** - No binaries or large files
|
|
55
|
+
- [ ] **No sensitive data** - No API keys, passwords, etc.
|
|
56
|
+
|
|
57
|
+
## Reviewer Checklist
|
|
58
|
+
|
|
59
|
+
### Code Review
|
|
60
|
+
|
|
61
|
+
- [ ] **Logic correctness** - Does the code do what it's supposed to?
|
|
62
|
+
- [ ] **Type safety** - Are all types correct and complete?
|
|
63
|
+
- [ ] **Error handling** - Are errors handled appropriately?
|
|
64
|
+
- [ ] **Security** - No security vulnerabilities introduced?
|
|
65
|
+
|
|
66
|
+
### Architecture
|
|
67
|
+
|
|
68
|
+
- [ ] **Import hierarchy** - Follows layer architecture (types → utils → core → agents → cli)
|
|
69
|
+
- [ ] **Module boundaries** - No circular dependencies
|
|
70
|
+
- [ ] **Separation of concerns** - Each module has single responsibility
|
|
71
|
+
|
|
72
|
+
### Testing
|
|
73
|
+
|
|
74
|
+
- [ ] **Test quality** - Tests are meaningful and comprehensive
|
|
75
|
+
- [ ] **Test coverage** - Coverage meets targets
|
|
76
|
+
- [ ] **Mock providers** - Tests use AUTOMATOSX_MOCK_PROVIDERS=true
|
|
77
|
+
|
|
78
|
+
### Documentation
|
|
79
|
+
|
|
80
|
+
- [ ] **JSDoc complete** - Public APIs have JSDoc
|
|
81
|
+
- [ ] **README updated** - If adding features, update README
|
|
82
|
+
- [ ] **CHANGELOG updated** - Add entry to CHANGELOG.md
|
|
83
|
+
|
|
84
|
+
### Performance & Size
|
|
85
|
+
|
|
86
|
+
- [ ] **No new large deps** - Check package.json for new dependencies
|
|
87
|
+
- [ ] **Bundle size** - Run `npm run build` and check dist/index.js size
|
|
88
|
+
- [ ] **Startup time** - CLI startup time reasonable
|
|
89
|
+
|
|
90
|
+
## Common Patterns
|
|
91
|
+
|
|
92
|
+
### Type Safety
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// ❌ Avoid
|
|
96
|
+
const data: any = loadData();
|
|
97
|
+
|
|
98
|
+
// ✅ Prefer
|
|
99
|
+
const data: ProfileData = loadProfile(name);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Error Handling
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// ❌ Avoid: Silent failure
|
|
106
|
+
try {
|
|
107
|
+
await task();
|
|
108
|
+
} catch (e) { }
|
|
109
|
+
|
|
110
|
+
// ✅ Prefer: Log and re-throw
|
|
111
|
+
try {
|
|
112
|
+
await task();
|
|
113
|
+
} catch (error) {
|
|
114
|
+
logger.error('Task failed', {
|
|
115
|
+
task: taskName,
|
|
116
|
+
error: (error as Error).message
|
|
117
|
+
});
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Security
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// ❌ Avoid: Path traversal risk
|
|
126
|
+
const path = join(root, userInput);
|
|
127
|
+
|
|
128
|
+
// ✅ Prefer: Validated path
|
|
129
|
+
const resolver = new PathResolver({ projectRoot: root });
|
|
130
|
+
const path = await resolver.resolve(userInput);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Logging
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// ❌ Avoid
|
|
137
|
+
console.log('Profile loaded');
|
|
138
|
+
|
|
139
|
+
// ✅ Prefer
|
|
140
|
+
logger.info('Profile loaded', {
|
|
141
|
+
name: profileName,
|
|
142
|
+
path: profilePath
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
**Last Updated:** 2025-10-10
|
|
149
|
+
**For:** AutomatosX v5.0+
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Our Coding Standards - AutomatosX v5
|
|
2
|
+
|
|
3
|
+
> Project-specific coding standards for AutomatosX
|
|
4
|
+
|
|
5
|
+
## TypeScript Standards
|
|
6
|
+
|
|
7
|
+
**Strict mode enabled:**
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"strict": true,
|
|
12
|
+
"noUncheckedIndexedAccess": true,
|
|
13
|
+
"noImplicitOverride": true,
|
|
14
|
+
"noFallthroughCasesInSwitch": true
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Type annotations:**
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// ✅ Good: Explicit types for public APIs
|
|
22
|
+
export function loadProfile(name: string): Promise<AgentProfile> { }
|
|
23
|
+
|
|
24
|
+
// ❌ Bad: Any types
|
|
25
|
+
function process(data: any) { } // Never use any!
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Error handling:**
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// ✅ Good: Typed errors from utils/errors.ts
|
|
32
|
+
import { AgentValidationError, PathError } from '../utils/errors.js';
|
|
33
|
+
|
|
34
|
+
if (!profile.name) {
|
|
35
|
+
throw new AgentValidationError('Missing required field: name');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Include error context
|
|
39
|
+
try {
|
|
40
|
+
await executeTask();
|
|
41
|
+
} catch (error) {
|
|
42
|
+
logger.error('Task execution failed', {
|
|
43
|
+
task: taskName,
|
|
44
|
+
agent: agentName,
|
|
45
|
+
error: (error as Error).message
|
|
46
|
+
});
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Module system (ESM with .js extensions):**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// ✅ Good: .js extension in imports (required for ESM)
|
|
55
|
+
import { PathResolver } from '../core/path-resolver.js';
|
|
56
|
+
import type { AgentProfile } from '../types/agent.js';
|
|
57
|
+
|
|
58
|
+
// ❌ Bad: No extension
|
|
59
|
+
import { PathResolver } from '../core/path-resolver';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Code Quality Standards
|
|
63
|
+
|
|
64
|
+
**Function size (<50 lines):**
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// ✅ Good: Small, focused function
|
|
68
|
+
private buildPrompt(context: ExecutionContext): string {
|
|
69
|
+
let prompt = '';
|
|
70
|
+
if (context.abilities) {
|
|
71
|
+
prompt += `# Your Abilities\n\n${context.abilities}\n\n`;
|
|
72
|
+
}
|
|
73
|
+
if (context.agent.stages) {
|
|
74
|
+
prompt += this.buildStagesSection(context.agent.stages);
|
|
75
|
+
}
|
|
76
|
+
prompt += `# Task\n\n${context.task}`;
|
|
77
|
+
return prompt;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Naming conventions:**
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// ✅ Good: Descriptive names
|
|
85
|
+
const profilePath = join(profilesDir, `${name}.yaml`);
|
|
86
|
+
async function resolveAgentName(input: string): Promise<string> { }
|
|
87
|
+
|
|
88
|
+
// ✅ Good: PascalCase for classes
|
|
89
|
+
export class PathResolver { }
|
|
90
|
+
export class MemoryManager { }
|
|
91
|
+
|
|
92
|
+
// ❌ Bad: Abbreviations or vague names
|
|
93
|
+
const p = join(dir, `${n}.yaml`);
|
|
94
|
+
export class PM { }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**JSDoc for public APIs:**
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
/**
|
|
101
|
+
* Load agent profile from YAML file
|
|
102
|
+
*
|
|
103
|
+
* @param name - Agent name (e.g., "backend", "quality")
|
|
104
|
+
* @returns Validated AgentProfile
|
|
105
|
+
* @throws AgentNotFoundError if profile doesn't exist
|
|
106
|
+
* @throws AgentValidationError if profile is invalid
|
|
107
|
+
*/
|
|
108
|
+
async loadProfile(name: string): Promise<AgentProfile> { }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Security Standards
|
|
112
|
+
|
|
113
|
+
**Always use PathResolver:**
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// ✅ Good: Use PathResolver for all file access
|
|
117
|
+
import { PathResolver } from '../core/path-resolver.js';
|
|
118
|
+
|
|
119
|
+
const resolver = new PathResolver({ projectRoot });
|
|
120
|
+
const safePath = await resolver.resolve(userInput);
|
|
121
|
+
|
|
122
|
+
// ❌ Bad: Direct path manipulation
|
|
123
|
+
const path = join(projectRoot, userInput); // Unsafe!
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Input sanitization:**
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// ✅ Good: Sanitize before using in file system
|
|
130
|
+
const agentDirName = agentName
|
|
131
|
+
.replace(/[^a-zA-Z0-9-]/g, '-')
|
|
132
|
+
.toLowerCase();
|
|
133
|
+
|
|
134
|
+
// ✅ Good: File size limits to prevent DoS
|
|
135
|
+
if (content.length > 100 * 1024) {
|
|
136
|
+
throw new AgentValidationError('Profile file too large (max 100KB)');
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Restrictive permissions:**
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// ✅ Good: Restrict workspace permissions (Unix)
|
|
144
|
+
if (process.platform !== 'win32') {
|
|
145
|
+
await chmod(agentWorkspace, 0o700); // Owner only
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Testing Standards
|
|
150
|
+
|
|
151
|
+
**Structure with Vitest:**
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
155
|
+
|
|
156
|
+
describe('PathResolver', () => {
|
|
157
|
+
let resolver: PathResolver;
|
|
158
|
+
|
|
159
|
+
beforeEach(() => {
|
|
160
|
+
resolver = new PathResolver({ projectRoot: '/test' });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should resolve relative paths', async () => {
|
|
164
|
+
const result = await resolver.resolve('./file.txt');
|
|
165
|
+
expect(result).toBe('/test/file.txt');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should reject path traversal', async () => {
|
|
169
|
+
await expect(
|
|
170
|
+
resolver.resolve('../../../etc/passwd')
|
|
171
|
+
).rejects.toThrow(PathError);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Coverage targets:**
|
|
177
|
+
|
|
178
|
+
- Overall: 70%+ (currently 85%)
|
|
179
|
+
- Core modules: 85%+
|
|
180
|
+
- CLI commands: 70%+
|
|
181
|
+
- Utils: 90%+
|
|
182
|
+
|
|
183
|
+
## Logging Standards
|
|
184
|
+
|
|
185
|
+
**Use structured logging:**
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { logger } from '../utils/logger.js';
|
|
189
|
+
|
|
190
|
+
// ✅ Good: Structured logging with context
|
|
191
|
+
logger.info('Profile loaded', {
|
|
192
|
+
name: profileName,
|
|
193
|
+
path: profilePath
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
logger.error('Execution failed', {
|
|
197
|
+
agent: agentName,
|
|
198
|
+
task: taskSummary,
|
|
199
|
+
error: (error as Error).message
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// ❌ Bad: Console.log
|
|
203
|
+
console.log('Profile loaded');
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Log levels:**
|
|
207
|
+
|
|
208
|
+
- **debug:** Development details
|
|
209
|
+
- **info:** Normal operations
|
|
210
|
+
- **warn:** Recoverable issues
|
|
211
|
+
- **error:** Failures requiring attention
|
|
212
|
+
|
|
213
|
+
## Performance Standards
|
|
214
|
+
|
|
215
|
+
**Lazy loading:**
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
// ✅ Good: Lazy load heavy dependencies
|
|
219
|
+
async executeTask() {
|
|
220
|
+
const { spawn } = await import('child_process');
|
|
221
|
+
// ...
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Caching:**
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// ✅ Good: Cache profiles with TTL
|
|
229
|
+
this.cache = new TTLCache<AgentProfile>({
|
|
230
|
+
maxEntries: 20,
|
|
231
|
+
ttl: 300000, // 5 minutes
|
|
232
|
+
cleanupInterval: 60000
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Bundle size target:** <250KB (currently 381KB)
|
|
237
|
+
|
|
238
|
+
## Git Commit Standards
|
|
239
|
+
|
|
240
|
+
**Conventional Commits format:** `type(scope): message`
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Types
|
|
244
|
+
feat(agents): add stage injection to executor
|
|
245
|
+
fix(memory): resolve vector search timeout
|
|
246
|
+
docs(readme): update installation instructions
|
|
247
|
+
test(router): add retry logic tests
|
|
248
|
+
refactor(cli): simplify command parsing
|
|
249
|
+
perf(cache): optimize TTL cleanup interval
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Commit message structure:**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# ✅ Good: Clear, specific
|
|
256
|
+
feat(stages): inject workflow stages into prompt
|
|
257
|
+
|
|
258
|
+
- Add Stage and Personality interfaces to types
|
|
259
|
+
- Update ProfileLoader to parse stages from YAML
|
|
260
|
+
- Modify Executor to include stages in prompt
|
|
261
|
+
|
|
262
|
+
# ❌ Bad: Vague
|
|
263
|
+
fix: bug fix
|
|
264
|
+
update: changes
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
**Last Updated:** 2025-10-10
|
|
270
|
+
**For:** AutomatosX v5.0+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Our Project Structure - AutomatosX v5
|
|
2
|
+
|
|
3
|
+
> AutomatosX project organization and file structure conventions
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
automatosx/
|
|
9
|
+
├── src/ # TypeScript source code
|
|
10
|
+
│ ├── core/ # Router, PathResolver, MemoryManager, SessionManager
|
|
11
|
+
│ ├── agents/ # ProfileLoader, AbilitiesManager, ContextManager, Executor
|
|
12
|
+
│ ├── providers/ # Claude, Gemini, OpenAI implementations
|
|
13
|
+
│ ├── cli/ # CLI entry point and commands/
|
|
14
|
+
│ ├── types/ # TypeScript type definitions
|
|
15
|
+
│ └── utils/ # Logger, errors, formatters
|
|
16
|
+
│
|
|
17
|
+
├── tests/ # 1,149 tests (100% pass)
|
|
18
|
+
│ ├── unit/ # Core modules, utilities
|
|
19
|
+
│ ├── integration/ # CLI command flows
|
|
20
|
+
│ ├── e2e/ # Complete workflows
|
|
21
|
+
│ └── fixtures/ # Test helpers, mock providers
|
|
22
|
+
│
|
|
23
|
+
├── examples/
|
|
24
|
+
│ ├── agents/ # Example agent profiles (YAML)
|
|
25
|
+
│ ├── abilities/ # Example abilities (Markdown)
|
|
26
|
+
│ └── templates/ # Agent templates (v5.0.0+)
|
|
27
|
+
│
|
|
28
|
+
├── dist/ # Build output (381KB, gitignored)
|
|
29
|
+
│ ├── index.js # Bundled CLI (ESM)
|
|
30
|
+
│ ├── index.js.map
|
|
31
|
+
│ └── index.d.ts
|
|
32
|
+
│
|
|
33
|
+
├── .automatosx/ # User project directory (created by init)
|
|
34
|
+
│ ├── config.json # User configuration
|
|
35
|
+
│ ├── agents/ # User's custom agents
|
|
36
|
+
│ ├── abilities/ # User's custom abilities
|
|
37
|
+
│ ├── memory/ # SQLite database (memory.db)
|
|
38
|
+
│ ├── sessions/ # Session persistence
|
|
39
|
+
│ └── workspaces/ # Agent workspaces (isolated)
|
|
40
|
+
│
|
|
41
|
+
└── tmp/ # Temporary files (gitignored)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Module Import Hierarchy
|
|
45
|
+
|
|
46
|
+
**Dependency flow (imports only from lower layers):**
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Layer 1: types/ → No dependencies
|
|
50
|
+
Layer 2: utils/ → types/
|
|
51
|
+
Layer 3: core/ → types/, utils/
|
|
52
|
+
Layer 4: providers/ → types/, core/
|
|
53
|
+
Layer 5: agents/ → types/, utils/, core/
|
|
54
|
+
Layer 6: cli/ → All of the above
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Rule:** Higher layers can import from lower layers, never vice versa.
|
|
58
|
+
|
|
59
|
+
## File Naming Conventions
|
|
60
|
+
|
|
61
|
+
**TypeScript files:** `kebab-case.ts`
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
✅ path-resolver.ts, memory-manager.ts, claude-provider.ts
|
|
65
|
+
❌ PathResolver.ts, path_resolver.ts, pathResolver.ts
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Test files:** `{module-name}.test.ts`
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
✅ path-resolver.test.ts, memory-manager.test.ts
|
|
72
|
+
❌ path-resolver.spec.ts, test-path-resolver.ts
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Type files:** `{concept}.ts` (no -types suffix)
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
✅ types/agent.ts, types/provider.ts
|
|
79
|
+
❌ types/agent-types.ts, types/AgentTypes.ts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Configuration files:**
|
|
83
|
+
|
|
84
|
+
- YAML for agents: `examples/agents/backend.yaml`
|
|
85
|
+
- Markdown for abilities: `examples/abilities/code-generation.md`
|
|
86
|
+
- JSON for config: `.automatosx/config.json`
|
|
87
|
+
|
|
88
|
+
## Import Patterns
|
|
89
|
+
|
|
90
|
+
**ESM imports (always use .js extension):**
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// ✅ Good: Full path with .js
|
|
94
|
+
import { PathResolver } from '../core/path-resolver.js';
|
|
95
|
+
import type { AgentProfile } from '../types/agent.js';
|
|
96
|
+
|
|
97
|
+
// ❌ Bad: Missing .js extension
|
|
98
|
+
import { PathResolver } from '../core/path-resolver';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Type-only imports:**
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// ✅ Good: type-only imports (better tree-shaking)
|
|
105
|
+
import type { AgentProfile } from '../types/agent.js';
|
|
106
|
+
import type { Provider } from '../types/provider.js';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration Hierarchy
|
|
110
|
+
|
|
111
|
+
**Priority order:**
|
|
112
|
+
|
|
113
|
+
1. `.automatosx/config.json` (project-specific, created by `ax init`)
|
|
114
|
+
2. `automatosx.config.json` (project root, manually created)
|
|
115
|
+
3. `~/.automatosx/config.json` (user global)
|
|
116
|
+
4. `DEFAULT_CONFIG` (defaults in `src/types/config.ts`)
|
|
117
|
+
|
|
118
|
+
**Agent profiles search order:**
|
|
119
|
+
|
|
120
|
+
1. `.automatosx/agents/{name}.yaml` (user custom)
|
|
121
|
+
2. `examples/agents/{name}.yaml` (built-in)
|
|
122
|
+
|
|
123
|
+
**Abilities search order:**
|
|
124
|
+
|
|
125
|
+
1. `.automatosx/abilities/{name}.md` (user custom)
|
|
126
|
+
2. `examples/abilities/{name}.md` (built-in)
|
|
127
|
+
|
|
128
|
+
## Build Output
|
|
129
|
+
|
|
130
|
+
**Location:** `dist/`
|
|
131
|
+
|
|
132
|
+
- `index.js` - Bundled CLI (ESM, 381KB)
|
|
133
|
+
- `index.js.map` - Source map
|
|
134
|
+
- `index.d.ts` - Type definitions
|
|
135
|
+
|
|
136
|
+
**Bundle target:** ESM, Node 20+, <250KB target
|
|
137
|
+
|
|
138
|
+
## Workspace Structure
|
|
139
|
+
|
|
140
|
+
**Agent workspaces:** `.automatosx/workspaces/{agent-name}/`
|
|
141
|
+
|
|
142
|
+
- Isolated workspace for file operations
|
|
143
|
+
- Permissions: 700 (owner only on Unix)
|
|
144
|
+
|
|
145
|
+
**Memory storage:** `.automatosx/memory/memory.db`
|
|
146
|
+
|
|
147
|
+
- SQLite database with FTS5 full-text search
|
|
148
|
+
- < 1ms search performance
|
|
149
|
+
|
|
150
|
+
**Session storage:** `.automatosx/sessions/sessions.json`
|
|
151
|
+
|
|
152
|
+
- JSON-based persistence
|
|
153
|
+
- 100ms debounced saves
|
|
154
|
+
- Automatic cleanup (7+ days old)
|
|
155
|
+
|
|
156
|
+
## Security Boundaries
|
|
157
|
+
|
|
158
|
+
**Allowed reads:**
|
|
159
|
+
|
|
160
|
+
- `{projectRoot}/**/*` (validated by PathResolver)
|
|
161
|
+
|
|
162
|
+
**Allowed writes:**
|
|
163
|
+
|
|
164
|
+
- `.automatosx/workspaces/{agent-name}/**/*` only
|
|
165
|
+
|
|
166
|
+
**Forbidden:**
|
|
167
|
+
|
|
168
|
+
- Path traversal (`../../../etc/passwd`)
|
|
169
|
+
- Symbolic links outside project
|
|
170
|
+
- Writing outside workspace
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
**Last Updated:** 2025-10-10
|
|
175
|
+
**For:** AutomatosX v5.0+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Performance Analysis Ability
|
|
2
|
+
|
|
3
|
+
Identify and fix performance bottlenecks.
|
|
4
|
+
|
|
5
|
+
## Performance Metrics
|
|
6
|
+
|
|
7
|
+
1. **Response Time**
|
|
8
|
+
- Target: <100ms for API calls
|
|
9
|
+
- Target: <1s for page loads
|
|
10
|
+
- Measure: p50, p95, p99 latencies
|
|
11
|
+
|
|
12
|
+
2. **Throughput**
|
|
13
|
+
- Requests per second
|
|
14
|
+
- Concurrent users supported
|
|
15
|
+
- Resource utilization
|
|
16
|
+
|
|
17
|
+
3. **Resource Usage**
|
|
18
|
+
- CPU: Target <70% average
|
|
19
|
+
- Memory: No leaks, stable usage
|
|
20
|
+
- Disk I/O: Minimize random access
|
|
21
|
+
- Network: Bandwidth optimization
|
|
22
|
+
|
|
23
|
+
## Analysis Process
|
|
24
|
+
|
|
25
|
+
1. **Measure** (establish baseline)
|
|
26
|
+
- Use profilers (Chrome DevTools, Python cProfile)
|
|
27
|
+
- Monitor production metrics
|
|
28
|
+
- Identify slow operations
|
|
29
|
+
|
|
30
|
+
2. **Analyze** (find bottlenecks)
|
|
31
|
+
- Check database queries (N+1 problem)
|
|
32
|
+
- Review algorithm complexity
|
|
33
|
+
- Identify network round trips
|
|
34
|
+
- Check memory allocations
|
|
35
|
+
|
|
36
|
+
3. **Optimize** (targeted improvements)
|
|
37
|
+
- Add caching (Redis, CDN)
|
|
38
|
+
- Optimize database queries (indexes, query optimization)
|
|
39
|
+
- Use async/parallel processing
|
|
40
|
+
- Reduce payload sizes
|
|
41
|
+
|
|
42
|
+
4. **Verify** (measure improvements)
|
|
43
|
+
- Re-run benchmarks
|
|
44
|
+
- Compare before/after
|
|
45
|
+
- Check for regressions
|
|
46
|
+
- Monitor in production
|
|
47
|
+
|
|
48
|
+
## Common Performance Issues
|
|
49
|
+
|
|
50
|
+
- N+1 query problem (ORM)
|
|
51
|
+
- Missing database indexes
|
|
52
|
+
- Synchronous I/O blocking
|
|
53
|
+
- Large payload sizes
|
|
54
|
+
- No caching strategy
|
|
55
|
+
- Memory leaks
|
|
56
|
+
- Inefficient algorithms (O(n²) when O(n) possible)
|