@defai.digital/automatosx 5.6.35 → 5.7.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 +142 -0
- package/README.md +44 -2
- package/dist/index.js +1129 -345
- package/examples/agents/.automatosx/abilities/accessibility.md +115 -0
- package/examples/agents/.automatosx/abilities/api-design.md +159 -0
- package/examples/agents/.automatosx/abilities/best-practices.md +102 -0
- package/examples/agents/.automatosx/abilities/caching-strategy.md +165 -0
- package/examples/agents/.automatosx/abilities/ci-cd.md +61 -0
- package/examples/agents/.automatosx/abilities/clean-code.md +398 -0
- package/examples/agents/.automatosx/abilities/code-generation.md +95 -0
- package/examples/agents/.automatosx/abilities/code-review.md +42 -0
- package/examples/agents/.automatosx/abilities/component-architecture.md +112 -0
- package/examples/agents/.automatosx/abilities/content-creation.md +97 -0
- package/examples/agents/.automatosx/abilities/data-modeling.md +171 -0
- package/examples/agents/.automatosx/abilities/data-validation.md +50 -0
- package/examples/agents/.automatosx/abilities/db-modeling.md +158 -0
- package/examples/agents/.automatosx/abilities/debugging.md +43 -0
- package/examples/agents/.automatosx/abilities/dependency-audit.md +60 -0
- package/examples/agents/.automatosx/abilities/design-patterns.md +437 -0
- package/examples/agents/.automatosx/abilities/design-system-implementation.md +126 -0
- package/examples/agents/.automatosx/abilities/documentation.md +54 -0
- package/examples/agents/.automatosx/abilities/error-analysis.md +107 -0
- package/examples/agents/.automatosx/abilities/etl-pipelines.md +44 -0
- package/examples/agents/.automatosx/abilities/feasibility-study.md +20 -0
- package/examples/agents/.automatosx/abilities/general-assistance.md +26 -0
- package/examples/agents/.automatosx/abilities/idea-evaluation.md +21 -0
- package/examples/agents/.automatosx/abilities/infra-as-code.md +57 -0
- package/examples/agents/.automatosx/abilities/job-orchestration.md +44 -0
- package/examples/agents/.automatosx/abilities/literature-review.md +19 -0
- package/examples/agents/.automatosx/abilities/logical-analysis.md +21 -0
- package/examples/agents/.automatosx/abilities/longform-report.md +25 -0
- package/examples/agents/.automatosx/abilities/mathematical-reasoning.md +170 -0
- package/examples/agents/.automatosx/abilities/mission-analysis.md +49 -0
- package/examples/agents/.automatosx/abilities/observability.md +61 -0
- package/examples/agents/.automatosx/abilities/orbital-mechanics.md +50 -0
- package/examples/agents/.automatosx/abilities/our-architecture-decisions.md +180 -0
- package/examples/agents/.automatosx/abilities/our-code-review-checklist.md +149 -0
- package/examples/agents/.automatosx/abilities/our-coding-standards.md +270 -0
- package/examples/agents/.automatosx/abilities/our-project-structure.md +183 -0
- package/examples/agents/.automatosx/abilities/performance-analysis.md +56 -0
- package/examples/agents/.automatosx/abilities/performance.md +80 -0
- package/examples/agents/.automatosx/abilities/problem-solving.md +50 -0
- package/examples/agents/.automatosx/abilities/propulsion-systems.md +50 -0
- package/examples/agents/.automatosx/abilities/quantum-algorithm-design.md +54 -0
- package/examples/agents/.automatosx/abilities/quantum-error-correction.md +56 -0
- package/examples/agents/.automatosx/abilities/quantum-frameworks-transpilation.md +53 -0
- package/examples/agents/.automatosx/abilities/quantum-noise-modeling.md +58 -0
- package/examples/agents/.automatosx/abilities/refactoring.md +223 -0
- package/examples/agents/.automatosx/abilities/release-strategy.md +58 -0
- package/examples/agents/.automatosx/abilities/risk-assessment.md +19 -0
- package/examples/agents/.automatosx/abilities/secrets-policy.md +61 -0
- package/examples/agents/.automatosx/abilities/secure-coding-review.md +51 -0
- package/examples/agents/.automatosx/abilities/security-audit.md +65 -0
- package/examples/agents/.automatosx/abilities/software-architecture.md +394 -0
- package/examples/agents/.automatosx/abilities/solid-principles.md +341 -0
- package/examples/agents/.automatosx/abilities/sql-optimization.md +84 -0
- package/examples/agents/.automatosx/abilities/state-management.md +96 -0
- package/examples/agents/.automatosx/abilities/task-planning.md +65 -0
- package/examples/agents/.automatosx/abilities/technical-writing.md +77 -0
- package/examples/agents/.automatosx/abilities/telemetry-diagnostics.md +51 -0
- package/examples/agents/.automatosx/abilities/testing.md +47 -0
- package/examples/agents/.automatosx/abilities/threat-modeling.md +49 -0
- package/examples/agents/.automatosx/abilities/troubleshooting.md +80 -0
- package/examples/agents/.automatosx/agents/aerospace-scientist.yaml +75 -0
- package/examples/agents/.automatosx/agents/backend.yaml +152 -0
- package/examples/agents/.automatosx/agents/ceo.yaml +63 -0
- package/examples/agents/.automatosx/agents/creative-marketer.yaml +121 -0
- package/examples/agents/.automatosx/agents/cto.yaml +72 -0
- package/examples/agents/.automatosx/agents/data-scientist.yaml +124 -0
- package/examples/agents/.automatosx/agents/data.yaml +77 -0
- package/examples/agents/.automatosx/agents/design.yaml +74 -0
- package/examples/agents/.automatosx/agents/devops.yaml +89 -0
- package/examples/agents/.automatosx/agents/frontend.yaml +139 -0
- package/examples/agents/.automatosx/agents/fullstack.yaml +151 -0
- package/examples/agents/.automatosx/agents/mobile.yaml +161 -0
- package/examples/agents/.automatosx/agents/product.yaml +72 -0
- package/examples/agents/.automatosx/agents/quality.yaml +79 -0
- package/examples/agents/.automatosx/agents/quantum-engineer.yaml +75 -0
- package/examples/agents/.automatosx/agents/researcher.yaml +71 -0
- package/examples/agents/.automatosx/agents/security.yaml +86 -0
- package/examples/agents/.automatosx/agents/stan.yaml +189 -0
- package/examples/agents/.automatosx/agents/writer.yaml +78 -0
- package/examples/agents/.automatosx/teams/business.yaml +56 -0
- package/examples/agents/.automatosx/teams/core.yaml +60 -0
- package/examples/agents/.automatosx/teams/design.yaml +58 -0
- package/examples/agents/.automatosx/teams/engineering.yaml +69 -0
- package/examples/agents/.automatosx/teams/research.yaml +56 -0
- package/examples/agents/.automatosx/templates/analyst.yaml +60 -0
- package/examples/agents/.automatosx/templates/assistant.yaml +48 -0
- package/examples/agents/.automatosx/templates/basic-agent.yaml +28 -0
- package/examples/agents/.automatosx/templates/code-reviewer.yaml +52 -0
- package/examples/agents/.automatosx/templates/debugger.yaml +63 -0
- package/examples/agents/.automatosx/templates/designer.yaml +69 -0
- package/examples/agents/.automatosx/templates/developer.yaml +60 -0
- package/examples/agents/.automatosx/templates/fullstack-developer.yaml +395 -0
- package/examples/agents/.automatosx/templates/qa-specialist.yaml +71 -0
- package/examples/agents/.claude/commands/ax-agent.md +37 -0
- package/examples/agents/.claude/commands/ax-clear.md +22 -0
- package/examples/agents/.claude/commands/ax-init.md +25 -0
- package/examples/agents/.claude/commands/ax-list.md +19 -0
- package/examples/agents/.claude/commands/ax-memory.md +25 -0
- package/examples/agents/.claude/commands/ax-status.md +24 -0
- package/examples/agents/.claude/commands/ax-update.md +28 -0
- package/examples/agents/.claude/mcp/automatosx.json +244 -0
- package/examples/agents/CLAUDE.md +262 -0
- package/package.json +1 -1
|
@@ -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,170 @@
|
|
|
1
|
+
# Mathematical Reasoning
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
Rigorous mathematical analysis capabilities spanning linear algebra, calculus, probability, numerical methods, and symbolic reasoning to support research-grade problem solving, model verification, and algorithm design for Bob and Data Scientist while powering Quinn and Astrid workflows.
|
|
5
|
+
|
|
6
|
+
## Core Domains
|
|
7
|
+
|
|
8
|
+
### 1. Linear Algebra
|
|
9
|
+
- Matrix algebra (addition, multiplication, transposition, trace/determinant)
|
|
10
|
+
- Eigenvalue and eigenvector computation (power iteration, QR algorithm)
|
|
11
|
+
- Singular value decomposition, low-rank approximations, and PCA linkage
|
|
12
|
+
- Vector spaces, basis transformations, orthogonality, and projections
|
|
13
|
+
- Positive definiteness checks, conditioning, and spectral properties
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import numpy as np
|
|
17
|
+
|
|
18
|
+
A = np.array([[4., 2.], [1., 3.]])
|
|
19
|
+
|
|
20
|
+
eigvals, eigvecs = np.linalg.eig(A)
|
|
21
|
+
u, s, vt = np.linalg.svd(A)
|
|
22
|
+
proj = A @ np.linalg.solve(A.T @ A, A.T) # Least-squares projector
|
|
23
|
+
|
|
24
|
+
cond_number = np.linalg.cond(A)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Calculus & Optimization
|
|
28
|
+
- Differential calculus, gradients, Jacobians, Hessians
|
|
29
|
+
- Line search, Newton, quasi-Newton, and trust-region methods
|
|
30
|
+
- Constrained optimization (KKT conditions, Lagrange multipliers)
|
|
31
|
+
- Convex analysis, duality, strong/weak convexity checks
|
|
32
|
+
- Sensitivity analysis and automatic differentiation workflows
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import sympy as sp
|
|
36
|
+
|
|
37
|
+
x, y = sp.symbols('x y', real=True)
|
|
38
|
+
f = (x - 2)**2 + (y + 1)**2 + 3 * x * y
|
|
39
|
+
grad = [sp.diff(f, var) for var in (x, y)]
|
|
40
|
+
hessian = sp.hessian(f, (x, y))
|
|
41
|
+
|
|
42
|
+
λ = sp.symbols('λ')
|
|
43
|
+
constraint = x + y - 1
|
|
44
|
+
lagrangian = f + λ * constraint
|
|
45
|
+
kkt_eqs = [sp.diff(lagrangian, var) for var in (x, y, λ)]
|
|
46
|
+
solution = sp.solve(kkt_eqs, (x, y, λ), dict=True)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Probability & Statistics
|
|
50
|
+
- Probability distributions (continuous/discrete), conjugacy, transformations
|
|
51
|
+
- Bayesian inference (posterior computation, MAP/MCMC, credible intervals)
|
|
52
|
+
- Frequentist inference (hypothesis tests, p-values, confidence intervals)
|
|
53
|
+
- Estimators, bias-variance trade-offs, sufficiency, asymptotics
|
|
54
|
+
- Information measures (entropy, KL divergence, mutual information)
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import numpy as np
|
|
58
|
+
from scipy import stats
|
|
59
|
+
|
|
60
|
+
# Bayesian update for Beta-Binomial model
|
|
61
|
+
prior_a, prior_b = 2, 2
|
|
62
|
+
successes, trials = 18, 25
|
|
63
|
+
posterior = stats.beta(prior_a + successes, prior_b + trials - successes)
|
|
64
|
+
cred_interval = posterior.interval(0.95)
|
|
65
|
+
evidence = stats.binom.pmf(successes, trials, prior_a / (prior_a + prior_b))
|
|
66
|
+
|
|
67
|
+
# Frequentist hypothesis test
|
|
68
|
+
sample = np.random.normal(loc=1.05, scale=0.2, size=40)
|
|
69
|
+
t_stat, p_value = stats.ttest_1samp(sample, popmean=1.0)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. Numerical Methods
|
|
73
|
+
- Numerical integration (Gaussian quadrature, adaptive Simpson)
|
|
74
|
+
- Root finding (Newton-Raphson, secant, bracketing methods)
|
|
75
|
+
- ODE/PDE solvers (Runge-Kutta, implicit schemes, finite differences)
|
|
76
|
+
- Stability and convergence analysis, stiffness diagnostics
|
|
77
|
+
- Error bounds, conditioning, floating-point safeguards
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import numpy as np
|
|
81
|
+
from scipy.integrate import quad, solve_ivp
|
|
82
|
+
|
|
83
|
+
area, err = quad(lambda t: np.exp(-t**2), 0, np.inf)
|
|
84
|
+
|
|
85
|
+
def logistic(t, y, r=1.2, K=10.0):
|
|
86
|
+
return r * y * (1 - y / K)
|
|
87
|
+
|
|
88
|
+
solution = solve_ivp(logistic, (0, 20), [0.5], method="RK45", dense_output=True)
|
|
89
|
+
stability = np.max(np.abs(np.linalg.eigvals([[0., 1.], [-4., -1.5]])))
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 5. Symbolic Computation
|
|
93
|
+
- Formal manipulations (simplification, expansion, factorization)
|
|
94
|
+
- Symbolic integration/differentiation and series expansions
|
|
95
|
+
- Proof assistants for identity verification and equivalence checking
|
|
96
|
+
- Symbolic linear algebra, polynomial resultants, Groebner bases
|
|
97
|
+
- Derivation tracing with justification for documentation and review
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import sympy as sp
|
|
101
|
+
|
|
102
|
+
t = sp.symbols('t', positive=True)
|
|
103
|
+
series = sp.series(sp.sin(t) / t, t, 0, 6)
|
|
104
|
+
identity = sp.simplify(sp.exp(sp.I * t) * sp.exp(-sp.I * t))
|
|
105
|
+
proof = sp.Eq(sp.diff(sp.log(sp.factorial(t)), t), sp.digamma(t + 1))
|
|
106
|
+
|
|
107
|
+
M = sp.Matrix([[1, 2], [3, 4]])
|
|
108
|
+
eigen_decomp = M.eigenvects()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 6. Mathematical Verification Notebooks
|
|
112
|
+
- Structured Python notebooks using NumPy, SciPy, and SymPy for reproducible math experiments
|
|
113
|
+
- Cells organized by assumptions → derivations → numerical validation → sensitivity checks
|
|
114
|
+
- Parameterized widgets or YAML configs for scenario sweeps
|
|
115
|
+
- Automatic assertion blocks to verify algebraic vs. numeric equivalence
|
|
116
|
+
- Version-controlled notebooks (`.ipynb` or `.py` using Jupytext) with deterministic seeds
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
# verification_notebook.py (Jupytext style)
|
|
120
|
+
import numpy as np
|
|
121
|
+
import sympy as sp
|
|
122
|
+
from scipy.optimize import minimize
|
|
123
|
+
|
|
124
|
+
np.random.seed(42)
|
|
125
|
+
w = sp.symbols('w')
|
|
126
|
+
symbolic_grad = sp.diff(sp.sin(w) + w**2, w)
|
|
127
|
+
|
|
128
|
+
def objective(val):
|
|
129
|
+
return np.sin(val) + val**2
|
|
130
|
+
|
|
131
|
+
res = minimize(objective, x0=[0.5])
|
|
132
|
+
assert abs(symbolic_grad.subs({w: res.x[0]}) - 0) < 1e-6
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Best Practices
|
|
136
|
+
1. **State Assumptions Explicitly**: Document domains, constraints, and approximation regimes before derivations.
|
|
137
|
+
2. **Cross-Validate**: Confirm symbolic results with numerical experiments (Monte Carlo, sampling, discretization).
|
|
138
|
+
3. **Track Units and Scaling**: Maintain dimensional consistency and rescale ill-conditioned problems.
|
|
139
|
+
4. **Monitor Conditioning**: Inspect condition numbers and step sizes to pre-empt numerical instability.
|
|
140
|
+
5. **Use Reproducible Seeds**: Fix random seeds and record solver tolerances for repeatability.
|
|
141
|
+
6. **Validate Constraints**: Ensure solution candidates satisfy KKT or feasibility conditions post-optimization.
|
|
142
|
+
|
|
143
|
+
## Common Workflows
|
|
144
|
+
- Analytical derivation with SymPy → numerical verification via SciPy → documentation in notebook with Markdown proof steps.
|
|
145
|
+
- Linear algebra pipelines converting symbolic expressions to callable NumPy functions for high-performance evaluation.
|
|
146
|
+
- Bayesian model evaluation combining closed-form posteriors with MCMC diagnostics when conjugacy fails.
|
|
147
|
+
- PDE prototyping using finite differences followed by spectral method comparison for convergence profiling.
|
|
148
|
+
|
|
149
|
+
## Anti-patterns to Avoid
|
|
150
|
+
1. ❌ Treating floating-point equality as exact; always compare with tolerance windows.
|
|
151
|
+
2. ❌ Ignoring solver diagnostics (residual norms, iteration counts, Jacobian approximations).
|
|
152
|
+
3. ❌ Skipping preconditioning for stiff or ill-conditioned linear systems.
|
|
153
|
+
4. ❌ Mixing symbolic and numeric domains without explicit casting, leading to type errors or performance hits.
|
|
154
|
+
5. ❌ Assuming convergence without verifying gradients/Hessians or constraint satisfaction.
|
|
155
|
+
|
|
156
|
+
## Tooling & References
|
|
157
|
+
- **Core Libraries**: NumPy, SciPy, SymPy, JAX, PyTorch (autograd), cvxpy
|
|
158
|
+
- **Notebooks**: JupyterLab, VS Code notebooks, Jupytext for `.py` parity
|
|
159
|
+
- **Visualization**: Matplotlib, Plotly, seaborn for residuals and convergence plots
|
|
160
|
+
- **Verification**: hypothesis for property-based testing, pytest for deterministic assertions
|
|
161
|
+
- **Resources**: Matrix Cookbook, Boyd & Vandenberghe’s Convex Optimization, Numerical Recipes, Probabilistic Machine Learning (Murphy)
|
|
162
|
+
|
|
163
|
+
## Quick Checklist
|
|
164
|
+
- [ ] Assumptions and variable domains documented
|
|
165
|
+
- [ ] Symbolic derivations simplified and verified numerically
|
|
166
|
+
- [ ] Conditioning and stability assessed with diagnostics
|
|
167
|
+
- [ ] Optimization routines include gradient/Hessian validation
|
|
168
|
+
- [ ] Probabilistic models report uncertainty (CI or posterior summaries)
|
|
169
|
+
- [ ] Notebooks or scripts captured in version control with reproducible seeds
|
|
170
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Mission Analysis
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Plan space missions by evaluating launch windows, delta-v budgets, trajectory
|
|
6
|
+
options, and risk trades to deliver payloads on schedule while maximizing
|
|
7
|
+
scientific or commercial return.
|
|
8
|
+
|
|
9
|
+
## Core Concepts & Best Practices
|
|
10
|
+
|
|
11
|
+
- **Mission Phasing**: Decompose operations into launch, transfer, orbit
|
|
12
|
+
insertion, surface or operations, and disposal with clear success criteria.
|
|
13
|
+
- **Launch Window Analysis**: Compute pork-chop plots, C3 requirements, and
|
|
14
|
+
planetary alignment windows; maintain contingency windows.
|
|
15
|
+
- **Delta-v Accounting**: Build comprehensive budgets including injection,
|
|
16
|
+
transfer corrections, station-keeping, and end-of-life maneuvers.
|
|
17
|
+
- **Trajectory Optimization**: Compare impulsive versus continuous thrust,
|
|
18
|
+
gravity assists, and ballistic capture; quantify schedule sensitivity.
|
|
19
|
+
- **Risk Assessment**: Integrate failure modes, environmental hazards, and
|
|
20
|
+
regulatory constraints into mission timelines.
|
|
21
|
+
|
|
22
|
+
## Tools & Methodologies
|
|
23
|
+
|
|
24
|
+
- **Analytical Tools**: Use STK, GMAT, Copernicus, or Mission Analysis
|
|
25
|
+
Environment (MAE) for end-to-end trajectory design.
|
|
26
|
+
- **Optimization Suites**: Apply collocation methods, direct transcription
|
|
27
|
+
(GPOPS-II), or evolutionary algorithms for complex trajectories.
|
|
28
|
+
- **Trade Studies**: Perform design-to-cost, design-to-value, and SWOT analyses
|
|
29
|
+
for payload accommodation and launch vehicle selection.
|
|
30
|
+
- **Sensitivity Studies**: Conduct Monte Carlo dispersions and covariance
|
|
31
|
+
analyses to assess robustness to launch delays and navigation errors.
|
|
32
|
+
- **Documentation**: Produce Mission Concept Reviews (MCR), System Requirements
|
|
33
|
+
Reviews (SRR), and flight rule catalogs to align stakeholders.
|
|
34
|
+
|
|
35
|
+
## Example Scenario
|
|
36
|
+
|
|
37
|
+
An exploration program targets Mars orbit insertion in 2031. Analysts generate
|
|
38
|
+
pork-chop plots to identify optimal synodic windows, run Copernicus to compare
|
|
39
|
+
Hohmann versus low-thrust SEP transfers, and iterate delta-v budgets to
|
|
40
|
+
downselect to a gravity-assist trajectory that meets payload mass margins.
|
|
41
|
+
|
|
42
|
+
## Reference Resources
|
|
43
|
+
|
|
44
|
+
- Wertz & Larson, *Space Mission Analysis and Design*, Microcosm Press
|
|
45
|
+
- Brown, *Elements of Spacecraft Mission Design*, AIAA
|
|
46
|
+
- NASA Systems Engineering Handbook, NASA/SP-2016-6105
|
|
47
|
+
- GPOPS-II Documentation: <https://www.gpops2.com>
|
|
48
|
+
- ESA Mission Analysis Environment:
|
|
49
|
+
<https://www.esa.int/gsp/ACT/mission_analysis_environment>
|
|
@@ -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,50 @@
|
|
|
1
|
+
# Orbital Mechanics
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Analyze orbital dynamics for spacecraft, including multi-body perturbations,
|
|
6
|
+
station-keeping strategies, and maneuver planning that respects mission
|
|
7
|
+
constraints, propellant budgets, and operational safety.
|
|
8
|
+
|
|
9
|
+
## Core Concepts & Best Practices
|
|
10
|
+
|
|
11
|
+
- **Two-Body Foundations**: Master Keplerian elements, conic sections, Lambert
|
|
12
|
+
targeting, and orbital perturbation theory.
|
|
13
|
+
- **Perturbation Modeling**: Incorporate J2 oblateness, atmospheric drag, solar
|
|
14
|
+
radiation pressure, and third-body effects in long-duration analyses.
|
|
15
|
+
- **Maneuver Planning**: Design Hohmann, bi-elliptic, low-thrust, and
|
|
16
|
+
plane-change maneuvers; evaluate trade-offs between time, delta-v, and risk.
|
|
17
|
+
- **Relative Motion**: Apply Clohessy-Wiltshire and Tschauner-Hempel equations
|
|
18
|
+
for rendezvous; integrate collision avoidance envelopes.
|
|
19
|
+
- **Station-Keeping**: Develop periodic correction strategies for GEO, LEO
|
|
20
|
+
constellations, and Lagrange point orbits while balancing propellant and
|
|
21
|
+
pointing needs.
|
|
22
|
+
|
|
23
|
+
## Tools & Methodologies
|
|
24
|
+
|
|
25
|
+
- **Numerical Propagators**: Use GMAT, Orekit, STK, Basilisk, or custom
|
|
26
|
+
Runge-Kutta integrators with event detection for shadow entry or exit.
|
|
27
|
+
- **Astrodynamics Libraries**: Leverage poliastro, NASA GMAT API, and JPL SPICE
|
|
28
|
+
kernels for ephemeris and frame transformations.
|
|
29
|
+
- **Optimization Routines**: Employ differential correction, sequential
|
|
30
|
+
quadratic programming, or heuristic search for multi-burn sequences.
|
|
31
|
+
- **Monte Carlo Analysis**: Simulate maneuver execution dispersions and
|
|
32
|
+
environmental uncertainties to bound state covariance growth.
|
|
33
|
+
- **Validation & Verification**: Cross-check analytical solutions with
|
|
34
|
+
high-fidelity propagators; maintain traceability of gravitational models and
|
|
35
|
+
reference frames.
|
|
36
|
+
|
|
37
|
+
## Example Scenario
|
|
38
|
+
|
|
39
|
+
A mission team plans a lunar orbit insertion. They run Lambert targeting from
|
|
40
|
+
translunar injection to perilune, account for Earth-Moon three-body
|
|
41
|
+
perturbations using GMAT, and apply sequential quadratic programming to
|
|
42
|
+
minimize delta-v while satisfying lighting constraints for optical navigation.
|
|
43
|
+
|
|
44
|
+
## Reference Resources
|
|
45
|
+
|
|
46
|
+
- Vallado, *Fundamentals of Astrodynamics and Applications*, Microcosm Press
|
|
47
|
+
- Curtis, *Orbital Mechanics for Engineering Students*, Butterworth-Heinemann
|
|
48
|
+
- NASA GMAT User Guide: <https://gmatcentral.org>
|
|
49
|
+
- Orekit Documentation: <https://www.orekit.org>
|
|
50
|
+
- JPL SPICE Toolkit: <https://naif.jpl.nasa.gov/naif/toolkit.html>
|