Commit Graph

75 Commits

Author SHA1 Message Date
Apple
fa749fa56c chore(infra): add NODA2 setup files, docker-compose configs and root config
- AGENTS.md: Sofiia Chief AI Architect role definition
- SOFIIA_IN_OPENCODE.md, SOFIIA_NODA2_SETUP.md: NODA2 setup documentation
- agromatrix_stepan_noda1_APPLY.md, agromatrix_stepan_noda1_prod.patch: AgroMatrix production patch
- docker-compose.memory-node2.yml: memory service for NODA2
- docker-compose.node2-sofiia-supervisor.yml: sofiia supervisor for NODA2
- gateway-bot/gateway_boot.py, monitor_prompt.txt, vision_guard.py: gateway extras
- models/Modelfile.qwen3.5-35b-a3b: Qwen model definition for NODA3
- opencode.json: OpenCode providers and agents config
- scripts/init-sofiia-memory.py, scripts/node2/*, start-memory-node2.sh: NODA2 init scripts
- setup_sofiia_node2.sh: NODA2 full setup script

Made-with: Cursor
2026-03-03 07:15:20 -08:00
Apple
e9dedffa48 feat(production): sync all modified production files to git
Includes updates across gateway, router, node-worker, memory-service,
aurora-service, swapper, sofiia-console UI and node2 infrastructure:

- gateway-bot: Dockerfile, http_api.py, druid/aistalk prompts, doc_service
- services/router: main.py, router-config.yml, fabric_metrics, memory_retrieval,
  offload_client, prompt_builder
- services/node-worker: worker.py, main.py, config.py, fabric_metrics
- services/memory-service: Dockerfile, database.py, main.py, requirements
- services/aurora-service: main.py (+399), kling.py, quality_report.py
- services/swapper-service: main.py, swapper_config_node2.yaml
- services/sofiia-console: static/index.html (console UI update)
- config: agent_registry, crewai_agents/teams, router_agents
- ops/fabric_preflight.sh: updated preflight checks
- router-config.yml, docker-compose.node2.yml: infra updates
- docs: NODA1-AGENT-ARCHITECTURE, fabric_contract updated

Made-with: Cursor
2026-03-03 07:13:29 -08:00
Apple
32989525fb feat(sofiia-prompt): add hardware dev Sergiy Plis (@vetr369) to development team
- adds Development Team section with Сергій Миколайович Пліс (@vetr369)
  as Hardware Engineer & Infrastructure Specialist for DAGI nodes
- grants developer-level access to technical node/infra information

Made-with: Cursor
2026-03-03 05:07:59 -08:00
Apple
90080c632a fix(fabric): use broadcast subject for NATS capabilities discovery
NATS wildcards (node.*.capabilities.get) only work for subscriptions,
not for publish. Switch to a dedicated broadcast subject
(fabric.capabilities.discover) that all NCS instances subscribe to,
enabling proper scatter-gather discovery across nodes.

Made-with: Cursor
2026-02-27 03:20:13 -08:00
Apple
a6531507df merge: integrate remote codex/sync-node1-runtime with fabric layer changes
Resolve conflicts in docker-compose.node1.yml, services/router/main.py,
and gateway-bot/services/doc_service.py — keeping both fabric layer
(NCS, node-worker, Prometheus) and document ingest/query endpoints.

Made-with: Cursor
2026-02-27 03:09:12 -08:00
NODA1 System
088ca07137 feat(gateway): proxy artifact downloads via public doc endpoints 2026-02-21 17:22:06 +01:00
NODA1 System
cca16254e5 feat(docs): add document write-back publish pipeline 2026-02-21 17:02:55 +01:00
NODA1 System
f53e71a0f4 feat(docs): add versioned document update and versions APIs 2026-02-21 16:49:24 +01:00
NODA1 System
5d52cf81c4 feat(docs): add standard file processing and router document ingest/query 2026-02-21 14:02:59 +01:00
NODA1 System
f44e920486 agromatrix: enforce mentor auth and expose shared-memory review via gateway 2026-02-21 13:18:36 +01:00
NODA1 System
f3d2aa6499 agromatrix: invalidate wrong photo labels and tighten correction parsing 2026-02-21 13:18:36 +01:00
NODA1 System
3d04cd4c88 agromatrix: harden correction parser + cap context + persist last photo ref 2026-02-21 13:18:36 +01:00
NODA1 System
a91309de11 agromatrix: deploy context/photo learning + deterministic excel policy 2026-02-21 13:18:36 +01:00
Apple
e00e7af1e7 agromatrix: harden correction learning and invalidate wrong labels 2026-02-21 02:25:40 -08:00
Lord of Chaos
815a287474 Gateway/Doc: source-lock, PII guard, intent retry, shared Excel contract (#4)
* gateway: enforce source-lock, pii guard, style profile, and intent retry

* doc-service: add shared deterministic excel answer contract

* gateway: auto-handle unresolved user questions in chat context

* gateway: fix greeting UX and reduce false photo-intent fallbacks

---------

Co-authored-by: Apple <apple@MacBook-Pro.local>
2026-02-21 10:16:43 +02:00
Apple
2b0b142f95 gateway: fix greeting UX and reduce false photo-intent fallbacks 2026-02-21 00:05:09 -08:00
Apple
0a87eadb8d gateway: auto-handle unresolved user questions in chat context 2026-02-20 23:54:52 -08:00
Apple
7b5357228f doc-service: add shared deterministic excel answer contract 2026-02-20 14:16:16 -08:00
Apple
e6c083a000 gateway: enforce source-lock, pii guard, style profile, and intent retry 2026-02-20 14:16:07 -08:00
Apple
195eb9b7ac agents: add planned AISTALK orchestrator and crew profile 2026-02-20 10:24:59 -08:00
NODA1 System
ce6c9ec60a gateway: add natural-language action mapping for reminders and mentor relay 2026-02-20 19:17:18 +01:00
NODA1 System
c2f0b64604 gateway: add privacy guard plus reminders and mentor relay commands 2026-02-20 19:01:50 +01:00
NODA1 System
90eff85662 crewai: add agromatrix and plant-intel role packs with updated team config 2026-02-20 17:56:55 +01:00
NODA1 System
9ecce79810 registry: assign district_id for agents and add district registry catalog 2026-02-20 17:56:05 +01:00
NODA1 System
2e76ef9ccb gateway: add public invoke/jobs facade with redis queue worker and SSE 2026-02-20 17:55:47 +01:00
NODA1 System
7e82a427e3 gateway: add redis-backed city metrics poller and /v1/metrics/dashboard 2026-02-20 15:44:17 +01:00
Apple
dfc0ef1ceb runtime: sync router/gateway/config policy and clan role registry 2026-02-19 00:14:06 -08:00
Apple
bfd0e05bc9 doc-service: parse fact_value_json string in doc context lookup 2026-02-18 09:37:54 -08:00
Apple
30ea12e0f8 doc-service: persist doc_context by stable session key 2026-02-18 09:37:12 -08:00
Apple
d42bb09912 helion: stabilize doc context, remove legacy webhook path, add stack smoke canary 2026-02-18 09:36:16 -08:00
Apple
635f2d7e37 helion: deepseek-first, on-demand CrewAI, local subagent profiles, concise post-synthesis 2026-02-18 09:21:47 -08:00
Apple
343bdc2d11 prompts: add DAARWIZZ awareness to legacy nutra prompt 2026-02-18 08:44:04 -08:00
Apple
6b5e462c85 prompts: enforce DAARWIZZ awareness across top-level agents 2026-02-18 08:43:29 -08:00
Apple
2c03632f67 senpai: enforce DAARWIZZ network awareness; sync daarwizz delegation roster 2026-02-18 08:12:03 -08:00
Apple
21576f0ca3 node1: add universal file tool, gateway document delivery, and sync runbook 2026-02-15 01:50:37 -08:00
Apple
7887f7cbe9 fix: DSML fallback — 3rd LLM call for clean synthesis + think tag stripping
Router (main.py):
- When DSML detected in 2nd LLM response after tool execution,
  make a 3rd LLM call with explicit synthesis prompt instead of
  returning raw tool results to the user
- Falls back to format_tool_calls_for_response only if 3rd call fails

Router (tool_manager.py):
- Added _strip_think_tags() helper for <think>...</think> removal
  from DeepSeek reasoning artifacts

Gateway (http_api.py):
- Strip <think>...</think> tags before sending to Telegram
- Strip DSML/XML-like markup (function_calls, invoke, parameter tags)
- Ensure empty text after stripping gets "..." fallback

Deployed to NODE1 and verified services running.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 10:30:37 -08:00
Apple
0cfd3619ea feat: auto-summarize trigger for agent memory
- Memory Service: POST /agents/{agent_id}/summarize endpoint
  - Fetches recent events by agent_id (new db.list_facts_by_agent)
  - Generates structured summary via DeepSeek LLM
  - Saves summary to PostgreSQL facts + Qdrant vector store
  - Returns structured JSON (summary, goals, decisions, key_facts)

- Gateway memory_client: auto-trigger after 30 turns
  - Turn counter per chat (agent_id:channel_id)
  - 5-minute debounce between summarize calls
  - Fire-and-forget via asyncio.ensure_future (non-blocking)
  - Configurable via SUMMARIZE_TURN_THRESHOLD / SUMMARIZE_DEBOUNCE_SECONDS

- Database: list_facts_by_agent() for agent-level queries without user_id

Tested on NODE1: Helion summarize returns valid Ukrainian summary with 20 events.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 10:15:43 -08:00
Apple
3b924118be fix: quarantine dead brand commands + implement Memory LLM summary
Brand commands (~290 lines):
- Code was trapped inside `if reply_to_message:` block (unreachable)
- Moved to feature flag: ENABLE_BRAND_COMMANDS=true to activate
- Zero re-indentation: 8sp code naturally fits as feature flag body
- Helper functions (_brand_*, _artifact_*) unchanged

Memory LLM Summary:
- Replace placeholder with real DeepSeek API integration
- Structured output: summary, goals, decisions, open_questions, next_steps, key_facts
- Graceful fallback if API key not set or call fails
- Added MEMORY_DEEPSEEK_API_KEY config
- Ukrainian output language

Deployed and verified on NODE1.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 09:42:44 -08:00
Apple
27e66b90bf feat: thread_has_agent_participation + ACK reply linkage
1. thread_has_agent_participation (SOWA Priority 11):
   - New function has_agent_chat_participation() in behavior_policy.py
   - Checks if agent responded to ANY user in this chat within 30min
   - When active + user asks question/imperative → agent responds
   - Different from per-user conversation_context (Priority 12)
   - Wired into both detect_explicit_request() and analyze_message()

2. ACK reply_to_message_id:
   - When SOWA sends ACK ("NUTRA тут"), it now replies to the user's
     message instead of sending a standalone message
   - Better UX: visually linked to what the user wrote
   - Uses allow_sending_without_reply=True for safety

Known issue (not fixed - too risky):
- Lines 1368-1639 in http_api.py are dead code (brand commands /бренд)
  at incorrect indentation level (8 spaces, inside unreachable block)
- These commands never worked on NODE1, fixing 260 lines of indentation
  carries regression risk — deferred to separate cleanup PR

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 09:24:00 -08:00
Apple
1f4472ec18 feat: reply-to-agent detection in Gateway → SOWA Priority 3
When a user replies to an agent's message in Telegram groups,
it is now treated as a direct mention (SOWA FULL response).

Implementation:
- Detect reply_to_message.from.is_bot in Gateway webhook handler
- Verify bot_id matches this agent's token (multi-agent safe)
- Pass is_reply_to_agent=True to detect_explicit_request() and
  analyze_message() (SOWA v2.2)
- Add is_reply_to_agent to Router metadata for analytics

SOWA already had Priority 3 logic for reply_to_agent → FULL,
it was just never wired up (had TODO placeholders with False).

Edge cases handled:
- Only triggers when reply is to THIS agent's bot (not other bots)
- Reply to forwarded messages: won't trigger (from.is_bot would be
  the original sender, not the bot)
- Works alongside existing DM, mention, and training group rules

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 09:16:02 -08:00
Apple
a1599df053 fix: SOWA agent name variants + vision denial prevention
SOWA fixes:
- Add Russian variants for all agents (сэнпай, хелион, друид, etc.)
- Add missing sofiia agent to AGENT_NAME_VARIANTS
- Add /senpai, /sofiia command prefixes

Vision denial fix (all 13 agents):
- Add explicit rule: "Never say you can't see/analyze images"
- Agents have Vision API via Swapper (qwen3-vl-8b)
- When vision model describes a photo, the follow-up text model (DeepSeek)
  must not deny having seen it

Root cause: NUTRA correctly analyzed a photo via vision model, but when
asked a follow-up question, DeepSeek (text model) responded "I cannot
see images" because the system prompt lacked the denial prevention rule.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 08:49:11 -08:00
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
Apple
134c044c21 feat: Behavior Policy v1 - Silent-by-default + Short-first + Media-no-comment
NODA1 agents now:
- Don't respond to broadcasts/posters/announcements without direct mention
- Don't respond to media (photo/link) without explicit question
- Keep responses short (1-2 sentences by default)
- No emoji, no "ready to help", no self-promotion

Added:
- behavior_policy.py: detect_directed_to_agent(), detect_broadcast_intent(), should_respond()
- behavior_policy_v1.txt: unified policy block for all prompts
- Pre-LLM check in http_api.py: skip Router call if should_respond=False
- NO_OUTPUT handling: don't send to Telegram if LLM returns empty
- Updated all 9 agent prompts with Behavior Policy v1
- Unit and E2E tests for 5 acceptance cases
2026-02-04 09:03:14 -08:00
Apple
c8698f6a1d feat: add training group support in Gateway
- Added TRAINING_GROUP_IDS constant for Agent Preschool group
- Gateway now adds "[РЕЖИМ НАВЧАННЯ]" prefix for training groups
- Agents will respond to all messages in training groups

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 08:03:07 -08:00
Apple
8907fb110c feat: add training mode for Agent Preschool group
All agents now respond to all messages in the training group
"Agent Preschool Daarion.city" without requiring mentions.

Updated prompts: helion, daarwizz, greenfood, nutra, agromatrix, druid

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 07:56:20 -08:00
Apple
0d30ea0009 fix: add group silence rules for Helion
Helion now only responds in groups when:
- Mentioned by name/username
- Direct question about Energy Union
- Previously was responding to all messages in groups

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 07:51:14 -08:00
Apple
a0a89b577d fix: add missing Telegram tokens for DAARWIZZ, DRUID, GREENFOOD
Synced from NODA1 after 2026-02-03 incident fix.
All 9 agents now have tokens configured.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 07:26:56 -08:00
Apple
b9b7660930 feat(P1): Add /metrics endpoint to gateway 2026-01-28 07:14:37 -08:00
Apple
a3923cd96f feat(P0/P1/P2): Add E2E agent prober, version pinning, prometheus fixes 2026-01-28 07:06:07 -08:00
Apple
0c8bef82f4 feat: Add Alateya, Clan, Eonarch agents + fix gateway-router connection
## Agents Added
- Alateya: R&D, biotech, innovations
- Clan (Spirit): Community spirit agent
- Eonarch: Consciousness evolution agent

## Changes
- docker-compose.node1.yml: Added tokens for all 3 new agents
- gateway-bot/http_api.py: Added configs and webhook endpoints
- gateway-bot/clan_prompt.txt: New prompt file
- gateway-bot/eonarch_prompt.txt: New prompt file

## Fixes
- Fixed ROUTER_URL from :9102 to :8000 (internal container port)
- All 9 Telegram agents now working

## Documentation
- Created PROJECT-MASTER-INDEX.md - single entry point
- Added various status documents and scripts

Tokens configured:
- Helion, NUTRA, Agromatrix (existing)
- Alateya, Clan, Eonarch (new)
- Druid, GreenFood, DAARWIZZ (configured)
2026-01-28 06:40:34 -08:00