Files
microdao-daarion/docs/agromatrix-stack.md
Apple ef3473db21 snapshot: NODE1 production state 2026-02-09
Complete snapshot of /opt/microdao-daarion/ from NODE1 (144.76.224.179).
This represents the actual running production code that has diverged
significantly from the previous main branch.

Key changes from old main:
- Gateway (http_api.py): expanded from ~40KB to 164KB with full agent support
- Router: new /v1/agents/{id}/infer endpoint with vision + DeepSeek routing
- Behavior Policy: SOWA v2.2 (3-level: FULL/ACK/SILENT)
- Agent Registry: config/agent_registry.yml as single source of truth
- 13 agents configured (was 3)
- Memory service integration
- CrewAI teams and roles

Excluded from snapshot: venv/, .env, data/, backups, .tgz archives

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 08:46:46 -08:00

141 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AgroMatrix Tools Stack (Stepan)
## Quick start
```bash
make up
```
## Demo telemetry ingest
```bash
make seed
```
## CrewAI (Stepan only)
Перед запуском:
```bash
export PYTHONPATH="$PWD/packages/agromatrix-tools"
```
```bash
PYTHONPATH="$PWD/packages/agromatrix-tools" python3 crews/agromatrix_crew/run.py "Покажи останні спостереження по вологості ґрунту"
```
## Spreadsheet demo
```bash
python3 scripts/demo_spreadsheet.py
```
## Notes
- Запис у farmOS відбувається тільки через Integration Service.
- Під-агенти CrewAI не спілкуються з користувачем напряму.
## Security (P0)
- Integration Service accepts writes only with HMAC headers (X-AGX-SIGNATURE, X-AGX-TIMESTAMP, X-AGX-NONCE).
- Configure AGX_HMAC_SECRET in env.
- farmOS write uses service account (FARMOS_USER/FARMOS_PASSWORD).
## DLQ
- Failed writes go to DLQ (Redis stream or /data/dlq.jsonl).
- Replay: `make replay-dlq`.
## Audit limits
- AGX_AUDIT_MAX_BYTES=4096
- AGX_AUDIT_REDACT_KEYS=token,secret,password,authorization,cookie,api_key,signature
## Trace testing
```bash
PYTHONPATH="$PWD/packages/agromatrix-tools" python3 crews/agromatrix_crew/run.py --trace trace-demo-001 "перевір trace"
```
## farmOS UI (опційно, через reverse-proxy)
1) Згенеруй bcrypt-хеш пароля:
```bash
docker run --rm caddy:2 caddy hash-password --plaintext 'your_password'
```
2) Заповни env:
- FARMOS_UI_PORT=18080
- FARMOS_UI_USER=admin
- FARMOS_UI_PASS_HASH=<hash>
3) Запусти профіль:
```bash
docker compose -f infra/compose/docker-compose.yml --profile farmos_ui up -d
```
Перевірка:
```bash
curl -I http://127.0.0.1:18080
# 401
curl -u admin:<pass> http://127.0.0.1:18080
```
Примітка: farmOS не має host-портів і залишається доступним тільки всередині docker network.
## Dictionaries & Normalization
- Source of truth: `data/dictionaries/dictionaries.yaml`
- Pending terms: `data/dictionaries/pending.jsonl`
Demo:
```bash
python3 scripts/demo_dictionary.py
```
Rules:
- If confidence < 0.85 or no match → pending record is written
- Use `tool_dictionary` before planning or writing
## OperationPlan Manager (P0)
- Data: `data/operations/operation_plans.jsonl`
- Schema: `crews/agromatrix_crew/operation_schema.json`
Demo:
```bash
python3 scripts/demo_operation_plan.py
```
## Dictionary Review Workflow (P0.5)
Pending review:
```bash
python3 scripts/dict_review.py list
python3 scripts/dict_review.py approve --ref pending.jsonl:1 --map-to crop_wheat_winter
python3 scripts/dict_review.py apply
```
Auto-approve (safe categories):
```bash
python3 scripts/dict_review.py auto-approve --min-score 0.97 --category unit --dry-run
```
## Telegram-операторські команди (Pending Review)
ENV:
- AGX_OPERATOR_IDS=12345,67890
- AGX_OPERATOR_CHAT_ID=-100123456 (optional)
Команди:
- /pending
- /pending_show pending.jsonl:17
- /approve pending.jsonl:17 map_to crop_wheat_winter
- /reject pending.jsonl:17 "reason"
- /apply_dict
- /pending_stats
- /whoami
### Operator flags
/pending --limit 20
/pending --category unit
/pending --category operation --limit 50
/approve pending.jsonl:17 map_to crop_wheat_winter --apply
Note: --apply requires AGX_ALLOW_APPLY=1 or AGX_OPS_MODE=1