@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,107 @@
|
|
|
1
|
+
# Error Analysis Ability
|
|
2
|
+
|
|
3
|
+
Analyze and understand error messages to find solutions.
|
|
4
|
+
|
|
5
|
+
## Error Analysis Process
|
|
6
|
+
|
|
7
|
+
1. **Read the Error Carefully**
|
|
8
|
+
- Full error message
|
|
9
|
+
- Error code/type
|
|
10
|
+
- Stack trace
|
|
11
|
+
- Context information
|
|
12
|
+
|
|
13
|
+
2. **Identify Error Type**
|
|
14
|
+
- Syntax error (typo, missing character)
|
|
15
|
+
- Runtime error (execution failure)
|
|
16
|
+
- Logic error (wrong output)
|
|
17
|
+
- Configuration error (missing setup)
|
|
18
|
+
|
|
19
|
+
3. **Locate the Source**
|
|
20
|
+
- File name and line number
|
|
21
|
+
- Stack trace (call chain)
|
|
22
|
+
- Relevant code section
|
|
23
|
+
- Recent changes
|
|
24
|
+
|
|
25
|
+
4. **Understand the Cause**
|
|
26
|
+
- What was the code trying to do?
|
|
27
|
+
- Why did it fail?
|
|
28
|
+
- What assumption was wrong?
|
|
29
|
+
- What conditions triggered it?
|
|
30
|
+
|
|
31
|
+
5. **Research if Needed**
|
|
32
|
+
- Search error message
|
|
33
|
+
- Check documentation
|
|
34
|
+
- Review similar issues
|
|
35
|
+
- Ask for help (with context)
|
|
36
|
+
|
|
37
|
+
## Common Error Patterns
|
|
38
|
+
|
|
39
|
+
### Null/Undefined Errors
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
TypeError: Cannot read property 'x' of undefined
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Cause: Accessing property on null/undefined
|
|
46
|
+
- Fix: Check if object exists first
|
|
47
|
+
- Prevention: Use optional chaining (?.)
|
|
48
|
+
|
|
49
|
+
### Type Errors
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
TypeError: 'int' object is not callable
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Cause: Using wrong type for operation
|
|
56
|
+
- Fix: Convert type or use correct type
|
|
57
|
+
- Prevention: Type annotations, validation
|
|
58
|
+
|
|
59
|
+
### Import/Module Errors
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
ModuleNotFoundError: No module named 'x'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Cause: Missing dependency or wrong path
|
|
66
|
+
- Fix: Install dependency or fix import path
|
|
67
|
+
- Prevention: Requirements file, path checks
|
|
68
|
+
|
|
69
|
+
### Network Errors
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
ConnectionError: Connection refused
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Cause: Service not running, wrong address, firewall
|
|
76
|
+
- Fix: Start service, check URL, check network
|
|
77
|
+
- Prevention: Health checks, retry logic
|
|
78
|
+
|
|
79
|
+
### Permission Errors
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
PermissionError: Permission denied
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- Cause: Insufficient file/resource permissions
|
|
86
|
+
- Fix: Grant permissions or run as correct user
|
|
87
|
+
- Prevention: Check permissions, use appropriate user
|
|
88
|
+
|
|
89
|
+
## Error Message Anatomy
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
TypeError: Cannot read property 'name' of undefined
|
|
93
|
+
at getUserName (app.js:42:18)
|
|
94
|
+
at handleRequest (app.js:15:10)
|
|
95
|
+
at Server.<anonymous> (app.js:8:5)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Parts:
|
|
99
|
+
|
|
100
|
+
1. **Error Type**: TypeError
|
|
101
|
+
2. **Error Message**: Cannot read property 'name' of undefined
|
|
102
|
+
3. **Stack Trace**: Call chain showing where error occurred
|
|
103
|
+
4. **Location**: app.js:42:18 (file:line:column)
|
|
104
|
+
|
|
105
|
+
## Debugging Workflow
|
|
106
|
+
|
|
107
|
+
1. Read error → 2. Identify location → 3. Examine code → 4. Form hypothesis → 5. Add logging → 6. Test fix → 7. Verify solution
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# ETL Pipelines
|
|
2
|
+
|
|
3
|
+
Build robust Extract, Transform, Load pipelines for data integration. Handle incremental loading, error recovery, and monitoring.
|
|
4
|
+
|
|
5
|
+
## Do's ✅
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
# ✅ Good: Incremental loading
|
|
9
|
+
last_sync = get_last_sync_timestamp()
|
|
10
|
+
new_data = source.extract(where=f"updated_at > '{last_sync}'")
|
|
11
|
+
transformed = transform(new_data)
|
|
12
|
+
warehouse.upsert(transformed, key_columns=['id'])
|
|
13
|
+
|
|
14
|
+
# ✅ Good: Idempotent operations
|
|
15
|
+
warehouse.upsert(data, key_columns=['id'], update_columns=['name', 'updated_at'])
|
|
16
|
+
|
|
17
|
+
# ✅ Good: Error handling with retry
|
|
18
|
+
try:
|
|
19
|
+
data = extract_from_api()
|
|
20
|
+
load_to_warehouse(transform(data))
|
|
21
|
+
except APIError as e:
|
|
22
|
+
log_error(e)
|
|
23
|
+
save_failed_batch(data) # Retry later
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Don'ts ❌
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
# ❌ Bad: Full table reload every time
|
|
30
|
+
data = source.extract_all() # Millions of rows!
|
|
31
|
+
warehouse.truncate()
|
|
32
|
+
warehouse.insert(data)
|
|
33
|
+
|
|
34
|
+
# ❌ Bad: No schema validation
|
|
35
|
+
for row in data:
|
|
36
|
+
warehouse.insert(row['id'], row['name']) # What if fields missing?
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Best Practices
|
|
40
|
+
- Use orchestration tools (Airflow, Prefect, Dagster)
|
|
41
|
+
- Implement data quality checks
|
|
42
|
+
- Monitor pipeline SLAs
|
|
43
|
+
- Version control transformation logic
|
|
44
|
+
- Document data lineage
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Goal
|
|
2
|
+
- Assess technical, operational, and economic feasibility with timelines and costs.
|
|
3
|
+
|
|
4
|
+
How to do it
|
|
5
|
+
- Define scope, constraints, and success criteria.
|
|
6
|
+
- Technical: stack fit, complexity, integration risks.
|
|
7
|
+
- Operational: processes, skills, SLAs, compliance.
|
|
8
|
+
- Economic: cost drivers (build/run), ROI windows, sensitivities.
|
|
9
|
+
|
|
10
|
+
Do
|
|
11
|
+
- Provide a small matrix (dimension × 1–5 score) and rationale.
|
|
12
|
+
- Add timeline bands (e.g., 2–4 weeks, 1–2 quarters) with key assumptions.
|
|
13
|
+
|
|
14
|
+
Don’t
|
|
15
|
+
- Don’t present estimates without assumptions.
|
|
16
|
+
- Don’t ignore maintenance/operational costs.
|
|
17
|
+
|
|
18
|
+
Output
|
|
19
|
+
- A feasibility summary with scores, assumptions, timeline bands, and go/no‑go recommendation.
|
|
20
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# General Assistance
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Provide helpful assistance for general tasks and inquiries.
|
|
6
|
+
|
|
7
|
+
## Capabilities
|
|
8
|
+
|
|
9
|
+
- Answer questions on various topics
|
|
10
|
+
- Provide explanations and clarifications
|
|
11
|
+
- Offer suggestions and recommendations
|
|
12
|
+
- Break down complex problems into manageable steps
|
|
13
|
+
|
|
14
|
+
## Usage Guidelines
|
|
15
|
+
|
|
16
|
+
- Be clear and concise in responses
|
|
17
|
+
- Ask clarifying questions when needed
|
|
18
|
+
- Provide examples to illustrate concepts
|
|
19
|
+
- Adapt communication style to user needs
|
|
20
|
+
|
|
21
|
+
## Best Practices
|
|
22
|
+
|
|
23
|
+
- Listen carefully to user requests
|
|
24
|
+
- Provide accurate and reliable information
|
|
25
|
+
- Be patient and understanding
|
|
26
|
+
- Follow up to ensure user satisfaction
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Goal
|
|
2
|
+
- Evaluate ideas against objectives, constraints, user value, and alternatives.
|
|
3
|
+
|
|
4
|
+
How to do it
|
|
5
|
+
- Clarify the objective, target users, and measurable outcomes.
|
|
6
|
+
- Identify assumptions; label each as validated, unvalidated, or unknown.
|
|
7
|
+
- Compare at least two alternatives; state trade‑offs.
|
|
8
|
+
- Use simple scoring (e.g., 1–5) for value, cost, risk, and time.
|
|
9
|
+
|
|
10
|
+
Do
|
|
11
|
+
- Show a short decision table with criteria and scores.
|
|
12
|
+
- Call out unknowns and how to validate them.
|
|
13
|
+
- Provide an executive summary before details.
|
|
14
|
+
|
|
15
|
+
Don’t
|
|
16
|
+
- Don’t assume feasibility without evidence.
|
|
17
|
+
- Don’t hide uncertainties; surface them with next steps.
|
|
18
|
+
|
|
19
|
+
Output
|
|
20
|
+
- A concise evaluation with assumptions, alternatives, scores, and a clear recommendation.
|
|
21
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Infrastructure as Code
|
|
2
|
+
|
|
3
|
+
Define and manage infrastructure through code using Terraform, Pulumi, or AWS CDK. Enable version control, reproducibility, and automation.
|
|
4
|
+
|
|
5
|
+
## Do's ✅
|
|
6
|
+
|
|
7
|
+
```hcl
|
|
8
|
+
# ✅ Good: Modular Terraform
|
|
9
|
+
resource "aws_vpc" "main" {
|
|
10
|
+
cidr_block = var.vpc_cidr
|
|
11
|
+
enable_dns_hostnames = true
|
|
12
|
+
|
|
13
|
+
tags = {
|
|
14
|
+
Name = "${var.project}-vpc"
|
|
15
|
+
Environment = var.environment
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# ✅ Good: Remote state with locking
|
|
20
|
+
terraform {
|
|
21
|
+
backend "s3" {
|
|
22
|
+
bucket = "terraform-state"
|
|
23
|
+
key = "prod/terraform.tfstate"
|
|
24
|
+
region = "us-east-1"
|
|
25
|
+
encrypt = true
|
|
26
|
+
dynamodb_table = "terraform-locks"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# ✅ Good: Use modules
|
|
31
|
+
module "vpc" {
|
|
32
|
+
source = "terraform-aws-modules/vpc/aws"
|
|
33
|
+
version = "~> 3.0"
|
|
34
|
+
name = "${var.project}-vpc"
|
|
35
|
+
cidr = var.vpc_cidr
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Don'ts ❌
|
|
40
|
+
|
|
41
|
+
```hcl
|
|
42
|
+
# ❌ Bad: Hardcoded values
|
|
43
|
+
resource "aws_instance" "web" {
|
|
44
|
+
ami = "ami-0c55b159cbfafe1f0" # Region-specific!
|
|
45
|
+
subnet_id = "subnet-12345" # Hardcoded
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# ❌ Bad: Manual changes
|
|
49
|
+
# Never modify infrastructure manually in console
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Best Practices
|
|
53
|
+
- Use workspaces for environments (dev/staging/prod)
|
|
54
|
+
- Enable state locking
|
|
55
|
+
- Always run `terraform plan` before apply
|
|
56
|
+
- Version pin modules and providers
|
|
57
|
+
- Implement automated testing (Terratest)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Job Orchestration
|
|
2
|
+
|
|
3
|
+
Schedule and orchestrate data jobs, pipelines, and workflows. Manage dependencies, retries, and monitoring using orchestration tools.
|
|
4
|
+
|
|
5
|
+
## Do's ✅
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
# ✅ Good: Clear task dependencies (Airflow)
|
|
9
|
+
from airflow import DAG
|
|
10
|
+
from airflow.operators.python import PythonOperator
|
|
11
|
+
|
|
12
|
+
with DAG('user_pipeline', schedule='0 2 * * *') as dag:
|
|
13
|
+
extract = PythonOperator(task_id='extract', python_callable=extract_users)
|
|
14
|
+
transform = PythonOperator(task_id='transform', python_callable=transform_users)
|
|
15
|
+
load = PythonOperator(task_id='load', python_callable=load_users)
|
|
16
|
+
|
|
17
|
+
extract >> transform >> load
|
|
18
|
+
|
|
19
|
+
# ✅ Good: Retry configuration
|
|
20
|
+
PythonOperator(
|
|
21
|
+
task_id='api_call',
|
|
22
|
+
python_callable=call_api,
|
|
23
|
+
retries=3,
|
|
24
|
+
retry_delay=timedelta(minutes=5),
|
|
25
|
+
retry_exponential_backoff=True
|
|
26
|
+
)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Don'ts ❌
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
# ❌ Bad: Complex dependencies
|
|
33
|
+
task1 >> [task2, task3, task4] >> task5 >> [task6, task7] >> task8
|
|
34
|
+
|
|
35
|
+
# ✅ Good: Logical groupings
|
|
36
|
+
extract_tasks >> transform_task >> load_tasks
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Best Practices
|
|
40
|
+
- Use task groups for related operations
|
|
41
|
+
- Implement SLA monitoring
|
|
42
|
+
- Configure alerting for failures
|
|
43
|
+
- Version control DAG definitions
|
|
44
|
+
- Use dynamic task generation when appropriate
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Goal
|
|
2
|
+
- Summarize prior work and credible sources; extract insights and gaps.
|
|
3
|
+
|
|
4
|
+
How to do it
|
|
5
|
+
- Collect 5–10 relevant sources; prefer primary research or official docs.
|
|
6
|
+
- For each source: key claim, method, limits, and applicability.
|
|
7
|
+
- Synthesize themes; identify contradictions and open questions.
|
|
8
|
+
|
|
9
|
+
Do
|
|
10
|
+
- Provide inline citations (Author/Org, Year or URL).
|
|
11
|
+
- Group findings by theme; call out where evidence is weak.
|
|
12
|
+
|
|
13
|
+
Don’t
|
|
14
|
+
- Don’t copy long quotes; summarize.
|
|
15
|
+
- Don’t mix citation and commentary without clearly separating them.
|
|
16
|
+
|
|
17
|
+
Output
|
|
18
|
+
- A thematic summary with citations and a short “Implications for this project” section.
|
|
19
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Goal
|
|
2
|
+
- Analyze arguments for validity, completeness, and hidden assumptions.
|
|
3
|
+
|
|
4
|
+
How to do it
|
|
5
|
+
- List premises and assumptions explicitly.
|
|
6
|
+
- Check inference steps; note logical fallacies or gaps.
|
|
7
|
+
- Consider counter‑examples and edge cases.
|
|
8
|
+
- Separate facts (with citations) from opinions (qualified language).
|
|
9
|
+
|
|
10
|
+
Do
|
|
11
|
+
- Use bullet points for premises → conclusion.
|
|
12
|
+
- Mark each step as sound/unsound with a brief note.
|
|
13
|
+
- Provide a short “What would change my conclusion?” section.
|
|
14
|
+
|
|
15
|
+
Don’t
|
|
16
|
+
- Don’t conflate correlation with causation.
|
|
17
|
+
- Don’t bury key assumptions.
|
|
18
|
+
|
|
19
|
+
Output
|
|
20
|
+
- A compact reasoning audit: premises, inferences, counter‑points, and a confidence rating.
|
|
21
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Goal
|
|
2
|
+
- Produce a structured, long‑form report suitable for stakeholders.
|
|
3
|
+
|
|
4
|
+
Structure
|
|
5
|
+
- Title, Author, Date
|
|
6
|
+
- Executive Summary (bullets)
|
|
7
|
+
- Background & Objectives
|
|
8
|
+
- Methodology (how you reasoned / sources)
|
|
9
|
+
- Findings (thematic)
|
|
10
|
+
- Analysis (logic, feasibility, risks)
|
|
11
|
+
- Options & Recommendations (w/ criteria)
|
|
12
|
+
- Citations & Appendices
|
|
13
|
+
|
|
14
|
+
Do
|
|
15
|
+
- Use clear headings, short paragraphs, and lists.
|
|
16
|
+
- Call out assumptions and uncertainties.
|
|
17
|
+
- Add tables where helpful (scores, risks, timelines).
|
|
18
|
+
|
|
19
|
+
Don’t
|
|
20
|
+
- Don’t bury the lede—start with the summary.
|
|
21
|
+
- Don’t omit sources when making claims.
|
|
22
|
+
|
|
23
|
+
Output
|
|
24
|
+
- A polished document following the above structure; aim for clarity over length.
|
|
25
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Observability
|
|
2
|
+
|
|
3
|
+
Implement logging, metrics, and tracing to understand system behavior. Monitor health, troubleshoot issues, and optimize performance.
|
|
4
|
+
|
|
5
|
+
## Three Pillars
|
|
6
|
+
|
|
7
|
+
### 1. Logs
|
|
8
|
+
```javascript
|
|
9
|
+
// ✅ Good: Structured logging
|
|
10
|
+
logger.info('User login', {
|
|
11
|
+
user_id: user.id,
|
|
12
|
+
ip: req.ip,
|
|
13
|
+
timestamp: new Date().toISOString()
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Metrics
|
|
18
|
+
```javascript
|
|
19
|
+
// ✅ Good: Application metrics (Prometheus)
|
|
20
|
+
const counter = new promClient.Counter({
|
|
21
|
+
name: 'http_requests_total',
|
|
22
|
+
help: 'Total HTTP requests',
|
|
23
|
+
labelNames: ['method', 'route', 'status']
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
app.use((req, res, next) => {
|
|
27
|
+
res.on('finish', () => {
|
|
28
|
+
counter.inc({ method: req.method, route: req.route, status: res.statusCode });
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. Traces
|
|
34
|
+
```javascript
|
|
35
|
+
// ✅ Good: Distributed tracing
|
|
36
|
+
const span = tracer.startSpan('get_user');
|
|
37
|
+
try {
|
|
38
|
+
const user = await db.getUser(id);
|
|
39
|
+
res.json(user);
|
|
40
|
+
} finally {
|
|
41
|
+
span.finish();
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Don'ts ❌
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
// ❌ Bad: Log sensitive data
|
|
49
|
+
logger.info('Login', { username, password }); // Never!
|
|
50
|
+
|
|
51
|
+
// ❌ Bad: Unstructured logs
|
|
52
|
+
console.log('User ' + user.id + ' logged in');
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Best Practices
|
|
56
|
+
- Use log levels appropriately
|
|
57
|
+
- Implement correlation IDs for tracing
|
|
58
|
+
- Set up dashboards for key metrics
|
|
59
|
+
- Configure alerts with thresholds
|
|
60
|
+
- Use APM tools (Datadog, New Relic)
|
|
61
|
+
- Implement SLOs and error budgets
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Our Architecture Decisions - AutomatosX v5
|
|
2
|
+
|
|
3
|
+
> Key architectural decisions and rationale for AutomatosX
|
|
4
|
+
|
|
5
|
+
## ADR-001: SQLite FTS5 Over Milvus
|
|
6
|
+
|
|
7
|
+
**Decision:** Use SQLite with FTS5 full-text search instead of Milvus
|
|
8
|
+
|
|
9
|
+
**Rationale:**
|
|
10
|
+
|
|
11
|
+
- v3.1 used Milvus (340MB bundle, complex setup)
|
|
12
|
+
- SQLite FTS5 offers < 1ms search performance
|
|
13
|
+
- Simple setup, no external services
|
|
14
|
+
|
|
15
|
+
**Impact:**
|
|
16
|
+
|
|
17
|
+
- ✅ Bundle: 340MB → 381KB (99.9% reduction)
|
|
18
|
+
- ✅ Fast text search (45ms → <1ms, 45x faster)
|
|
19
|
+
- ✅ No embedding costs (v4.11.0: removed vector search)
|
|
20
|
+
- ❌ Limited to single-node (acceptable for CLI tool)
|
|
21
|
+
|
|
22
|
+
## ADR-002: ESM Over CommonJS
|
|
23
|
+
|
|
24
|
+
**Decision:** Use ES Modules (ESM) for entire codebase
|
|
25
|
+
|
|
26
|
+
**Rationale:**
|
|
27
|
+
|
|
28
|
+
- Node.js 20+ has first-class ESM support
|
|
29
|
+
- Better tree-shaking and bundle optimization
|
|
30
|
+
- Modern standards compliance
|
|
31
|
+
|
|
32
|
+
**Impact:**
|
|
33
|
+
|
|
34
|
+
- ✅ Better tree-shaking (smaller bundle)
|
|
35
|
+
- ✅ Future-proof
|
|
36
|
+
- ⚠️ Requires `.js` in imports (minor inconvenience)
|
|
37
|
+
|
|
38
|
+
## ADR-003: TypeScript Strict Mode
|
|
39
|
+
|
|
40
|
+
**Decision:** Enable all strict TypeScript checks
|
|
41
|
+
|
|
42
|
+
**Configuration:**
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"strict": true,
|
|
47
|
+
"noUncheckedIndexedAccess": true,
|
|
48
|
+
"noImplicitOverride": true,
|
|
49
|
+
"noFallthroughCasesInSwitch": true
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Impact:**
|
|
54
|
+
|
|
55
|
+
- ✅ Fewer runtime errors
|
|
56
|
+
- ✅ Better IDE support
|
|
57
|
+
- ✅ Safer refactoring
|
|
58
|
+
- ⚠️ More initial development time (worth it)
|
|
59
|
+
|
|
60
|
+
## ADR-004: Three-Layer Security Model
|
|
61
|
+
|
|
62
|
+
**Decision:** Implement path validation, workspace isolation, and input sanitization
|
|
63
|
+
|
|
64
|
+
**Layers:**
|
|
65
|
+
|
|
66
|
+
1. **Path Resolution:** All file access through PathResolver
|
|
67
|
+
2. **Workspace Isolation:** Agent-specific workspaces with restricted permissions (700)
|
|
68
|
+
3. **Input Validation:** Sanitize all user inputs
|
|
69
|
+
|
|
70
|
+
**Impact:**
|
|
71
|
+
|
|
72
|
+
- ✅ Prevents path traversal attacks
|
|
73
|
+
- ✅ Agent isolation
|
|
74
|
+
- ✅ No privilege escalation
|
|
75
|
+
- ⚠️ Slightly more complex file operations
|
|
76
|
+
|
|
77
|
+
## ADR-005: Profile + Abilities = Agent
|
|
78
|
+
|
|
79
|
+
**Decision:** Separate agent profile (YAML) from abilities (Markdown)
|
|
80
|
+
|
|
81
|
+
**Structure:**
|
|
82
|
+
|
|
83
|
+
- Profile: YAML with metadata, systemPrompt, abilities references
|
|
84
|
+
- Abilities: Markdown files with domain knowledge
|
|
85
|
+
- Agent = Profile + loaded Abilities
|
|
86
|
+
|
|
87
|
+
**Impact:**
|
|
88
|
+
|
|
89
|
+
- ✅ Reusable abilities across agents
|
|
90
|
+
- ✅ Easy to add new knowledge
|
|
91
|
+
- ✅ Clear separation of concerns
|
|
92
|
+
- ✅ User can customize both independently
|
|
93
|
+
|
|
94
|
+
## ADR-006: Team-Based Configuration (v4.10.0+)
|
|
95
|
+
|
|
96
|
+
**Decision:** Agents inherit configuration from their team
|
|
97
|
+
|
|
98
|
+
**4 Built-in Teams:**
|
|
99
|
+
|
|
100
|
+
- **core:** Quality assurance (primary: claude)
|
|
101
|
+
- **engineering:** Software development (primary: codex)
|
|
102
|
+
- **business:** Product & planning (primary: gemini)
|
|
103
|
+
- **design:** Design & content (primary: gemini)
|
|
104
|
+
|
|
105
|
+
**Impact:**
|
|
106
|
+
|
|
107
|
+
- ✅ No configuration duplication
|
|
108
|
+
- ✅ Change provider for entire team at once
|
|
109
|
+
- ✅ Shared abilities automatically included
|
|
110
|
+
- ✅ Centralized orchestration settings
|
|
111
|
+
|
|
112
|
+
## ADR-007: Lazy Loading for Performance
|
|
113
|
+
|
|
114
|
+
**Decision:** Defer expensive imports until needed
|
|
115
|
+
|
|
116
|
+
**Implementation:**
|
|
117
|
+
|
|
118
|
+
- Heavy modules use dynamic import: `await import('module')`
|
|
119
|
+
- Core modules use static imports
|
|
120
|
+
- LazyLoader utility for caching
|
|
121
|
+
|
|
122
|
+
**Impact:**
|
|
123
|
+
|
|
124
|
+
- ✅ Faster CLI startup (~200ms)
|
|
125
|
+
- ✅ Smaller initial memory footprint
|
|
126
|
+
- ✅ Pay for what you use
|
|
127
|
+
|
|
128
|
+
## ADR-008: Vitest Over Jest
|
|
129
|
+
|
|
130
|
+
**Decision:** Use Vitest as testing framework
|
|
131
|
+
|
|
132
|
+
**Rationale:**
|
|
133
|
+
|
|
134
|
+
- Modern test runner with native ESM support
|
|
135
|
+
- Fast execution with watch mode
|
|
136
|
+
- Compatible with Vite ecosystem
|
|
137
|
+
|
|
138
|
+
**Impact:**
|
|
139
|
+
|
|
140
|
+
- ✅ Fast test execution (1,149 tests in ~10s)
|
|
141
|
+
- ✅ Native ESM support (no transform)
|
|
142
|
+
- ✅ Great developer experience
|
|
143
|
+
|
|
144
|
+
## ADR-009: TTL Cache for Profiles
|
|
145
|
+
|
|
146
|
+
**Decision:** Cache loaded profiles with 5-minute TTL
|
|
147
|
+
|
|
148
|
+
**Configuration:**
|
|
149
|
+
|
|
150
|
+
- TTLCache with 5-minute TTL
|
|
151
|
+
- Max 20 entries (LRU eviction)
|
|
152
|
+
- Cleanup every 60 seconds
|
|
153
|
+
|
|
154
|
+
**Impact:**
|
|
155
|
+
|
|
156
|
+
- ✅ Faster repeated executions
|
|
157
|
+
- ✅ Reduced file I/O
|
|
158
|
+
- ✅ Automatic cache invalidation
|
|
159
|
+
- ⚠️ 5-minute delay for profile updates (acceptable)
|
|
160
|
+
|
|
161
|
+
## ADR-010: Provider Router Pattern
|
|
162
|
+
|
|
163
|
+
**Decision:** Use Router to abstract provider selection
|
|
164
|
+
|
|
165
|
+
**Features:**
|
|
166
|
+
|
|
167
|
+
- Router manages provider selection
|
|
168
|
+
- Retry with exponential backoff
|
|
169
|
+
- Fallback to alternative providers
|
|
170
|
+
|
|
171
|
+
**Impact:**
|
|
172
|
+
|
|
173
|
+
- ✅ Provider flexibility
|
|
174
|
+
- ✅ Resilience to provider failures
|
|
175
|
+
- ✅ Easy to add new providers
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
**Last Updated:** 2025-10-10
|
|
180
|
+
**For:** AutomatosX v5.0+
|