01SituationАктивный фокусНЕ ЗАГРУЖЕН diff --git a/deploy/docker-compose.prod.yml b/deploy/docker-compose.prod.yml index d665d45..c90aef1 100644 --- a/deploy/docker-compose.prod.yml +++ b/deploy/docker-compose.prod.yml @@ -17,6 +17,7 @@ services: WORK_DB_PASSWORD: ${WORK_DB_PASSWORD} CAPABILITY_DB_PASSWORD: ${CAPABILITY_DB_PASSWORD} COMMIT_DB_PASSWORD: ${COMMIT_DB_PASSWORD} + EPISTEMICS_DB_PASSWORD_FILE: /run/secrets/epistemics_db_password INTERACTION_DB_PASSWORD_FILE: /run/secrets/interaction_db_password volumes: - assistant_pg:/var/lib/postgresql @@ -72,6 +73,9 @@ services: WORK_POSTGRES_PASSWORD: ${WORK_DB_PASSWORD} CAPABILITY_POSTGRES_USER: capability_role CAPABILITY_POSTGRES_PASSWORD: ${CAPABILITY_DB_PASSWORD} + EPISTEMICS_POSTGRES_USER: epistemics_role + EPISTEMICS_POSTGRES_CREDENTIAL_REF: credential://domovoy/epistemics/db-password/v1 + EPISTEMICS_POSTGRES_PASSWORD_FILE: /run/secrets/epistemics_db_password INTERACTION_POSTGRES_USER: interaction_role INTERACTION_POSTGRES_CREDENTIAL_REF: credential://domovoy/interaction/db-password/v1 INTERACTION_POSTGRES_PASSWORD_FILE: /run/secrets/interaction_db_password diff --git a/deploy/images/002_owner_passwords.sh b/deploy/images/002_owner_passwords.sh index 5184b99..40a7053 100644 --- a/deploy/images/002_owner_passwords.sh +++ b/deploy/images/002_owner_passwords.sh @@ -18,6 +18,13 @@ SQL psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v capability_password="$CAPABILITY_DB_PASSWORD" <<'SQL' ALTER ROLE capability_role PASSWORD :'capability_password'; SQL +if [ "${EPISTEMICS_DB_PASSWORD_FILE:-}" != "" ]; then + EPISTEMICS_DB_PASSWORD="$(tr -d '\r\n' < "$EPISTEMICS_DB_PASSWORD_FILE")" +fi +: "${EPISTEMICS_DB_PASSWORD:?EPISTEMICS_DB_PASSWORD or EPISTEMICS_DB_PASSWORD_FILE is required}" +psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v epistemics_password="$EPISTEMICS_DB_PASSWORD" <<'SQL' +ALTER ROLE epistemics_role PASSWORD :'epistemics_password'; +SQL psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -v ON_ERROR_STOP=1 -v commit_password="$COMMIT_DB_PASSWORD" <<'SQL' ALTER ROLE commit_role PASSWORD :'commit_password'; SQL diff --git a/dev/ACTIVE_TASK.json b/dev/ACTIVE_TASK.json index fd28b0d..39f90fa 100644 --- a/dev/ACTIVE_TASK.json +++ b/dev/ACTIVE_TASK.json @@ -1,5 +1,5 @@ { - "task_file": "dev/tasks/DEV-000067-experience-reflection-skill-evolution.json", - "task_id": "DEV-000067", + "task_file": "dev/tasks/DEV-000068-runtime-experience-reflection-loop.json", + "task_id": "DEV-000068", "task_revision": 1 } diff --git a/dev/tasks/DEV-000068-runtime-experience-reflection-loop.json b/dev/tasks/DEV-000068-runtime-experience-reflection-loop.json new file mode 100644 index 0000000..eb0d7fa --- /dev/null +++ b/dev/tasks/DEV-000068-runtime-experience-reflection-loop.json @@ -0,0 +1,138 @@ +{ + "task_id": "DEV-000068", + "task_revision": 1, + "architecture_revision": "ADR-0016", + "base_repo_revision": "67ff1f73cddfd94f9f5745acc87f997aed49630a", + "risk_tier": "E", + "intent": "Activate the first production runtime Experience and Reflection loop for meaningful /chat, HumanResponse, capability and fast-path outcomes without creating a LearningManager.", + "requirement_ids": [ + "ADR-0016", + "INV-OWN-001", + "INV-EPI-001", + "Runtime Experience capture", + "Runtime ReflectionCandidate triggers", + "SkillEvidence from real reminder response outcomes", + "Fast-path decline returns to reasoning/clarification" + ], + "allowed_change_scope": { + "modules": [ + "epistemics", + "capability", + "interaction", + "continuity" + ], + "paths": [ + "contracts/epistemics/**", + "contracts/capability/**", + "modules/epistemics/**", + "modules/capability/**", + "adapters/postgres/**", + "database/migrations/**", + "cmd/core-runtime/**", + "cmd/creator-web/**", + "cmd/continuity-runtime/**", + "deploy/docker-compose.prod.yml", + "deploy/images/002_owner_passwords.sh", + "deploy/windows/**", + "tests/owner_acl/**", + "tests/cognitive_advisory/**", + "docs/PROJECT_STATUS.md", + "dev/ACTIVE_TASK.json", + "dev/tasks/DEV-000068-runtime-experience-reflection-loop.json" + ] + }, + "forbidden_change_scope": { + "paths": [ + "architecture/ARCHITECTURE_CONSTITUTION.md", + "modules/authority/**", + "modules/commit/**", + "cmd/commit-runtime/**", + "security/**", + "ci/**", + ".gitea/**" + ] + }, + "allowed_architecture_delta": { + "new_cross_module_dependencies": 0, + "new_canonical_owners": 0, + "new_privileges": 0, + "new_third_party_dependencies": 0, + "new_provider_adapters": 0, + "new_runtime_secret_file_for_existing_owner": "epistemics_role database password for core-runtime" + }, + "contracts": { + "consume": [ + "Interaction HumanUtterance / OriginalHumanIntent / Correction refs", + "Continuity HumanResponse / Attention / ProspectiveItem refs", + "Capability CapabilityUsageObservation / CapabilityGap / SkillProfile", + "Epistemics SystemExpectation / ExperienceRecord / ReflectionCandidate" + ], + "may_change": [ + "contracts/epistemics@v1", + "contracts/capability@v1" + ] + }, + "semantic_owner": "epistemics", + "canonical_state": [ + "SystemExpectation", + "ExperienceRecord", + "ReflectionCandidate", + "SkillProfile" + ], + "state_transitions": [ + "meaningful chat help path -> SystemExpectation before outcome", + "HumanResponse resolved COMPLETE/SNOOZE/CANCEL -> positive ExperienceRecord and SkillProfile supporting evidence", + "Human correction -> USER_CORRECTED ExperienceRecord and ReflectionCandidate", + "ambiguous/no-target/unsupported fast path -> decline/clarification ExperienceRecord and ReflectionCandidate", + "repeated failure/correction evidence -> SkillProfile DEGRADED/SUSPENDED according to deterministic policy" + ], + "side_effects_and_privileges": [ + "No external mutation is introduced", + "No model output can directly mutate canonical state, Authority, source code, deployment or skill lifecycle", + "Core runtime receives only the existing Epistemics owner database credential through secret-file/CredentialRef mechanism", + "Creator Web remains a proxy/UI and receives no direct database credential", + "Docker-test remains prohibited" + ], + "persistence_and_migrations": [ + "no new canonical owner", + "no cross-owner FK", + "no cross-owner SQL join dependency", + "reuse DEV-000067 tables with optional indexes/projections only if needed" + ], + "failure_retry_restart": [ + "Experience/reflection capture is append-only and idempotent by generated IDs", + "A failed learning write must not pretend success; production acceptance verifies rows", + "Fast-path decline is valid safety behavior and does not mutate target state" + ], + "assumptions": [ + "DEV-000067 production foundation is active", + "ADR-0016 is sufficient; no new architecture owner is required", + "V1 uses deterministic reflection triggers; cognitive reflection remains optional candidate generation only" + ], + "acceptance_scenarios": [ + "Create reminder then complete it -> positive ExperienceRecord and SkillProfile supporting evidence", + "Create ambiguous targets and correct Domovoy -> USER_CORRECTED ExperienceRecord and ReflectionCandidate", + "Unsupported/uncertain response phrasing -> fast path declines and asks clarification/falls back without guessed mutation", + "Operator can inspect recent ExperienceRecords, ReflectionCandidates and SkillProfile status", + "Human chat does not expose internal learning IDs", + "LLM-free operation passes" + ], + "required_tests": [ + "go test ./...", + "go vet ./...", + "go run ./cmd/devctl preflight -active dev/ACTIVE_TASK.json", + "go run ./cmd/devctl check-architecture", + "go run ./cmd/devctl check-diff -active dev/ACTIVE_TASK.json", + "tests/cognitive_advisory/cognitive_worker_env_policy_test.ps1", + "tests/owner_acl/verify.ps1 -DockerContext docker-prod -PostgresContainer assistant-postgres-1", + "production live learning acceptance A/B/C", + "production health", + "production /chat verification" + ], + "terminal_gap_states": [ + "BLOCKED_BY_ARCHITECTURE_GAP", + "BLOCKED_BY_SPEC_GAP", + "BLOCKED_BY_MISSING_CAPABILITY", + "BLOCKED_BY_CONFLICT" + ] +}