diff --git a/AFI_Full_Architecture.md b/AFI_Full_Architecture.md index df9959f..16f60d3 100644 --- a/AFI_Full_Architecture.md +++ b/AFI_Full_Architecture.md @@ -42,7 +42,7 @@ The AFI organization is exactly **18 repositories** — 17 public and 1 private. | **afi-factory** | Pipeline **authoring** system + agent capability layer | Support — replaceable authoring | Authoring tool (not the executor) | | **afi-xerc20** | Vendored xERC20 standard (dependency of afi-token) | Reference | Compiled dependency | | **afi-docs** | Documentation hub | Reference | Not runtime | -| **afi-tiny-brains** *(private)* | Optional fail-soft ML enrichment sidecar (does not affect UWR scoring) | Support | Optional, fenced enrichment | +| **afi-tiny-brains** *(private)* | Bounded first-party aiMl orchestration service: one internal orchestrator runs the ProviderInstance-selected profile of approved experts through a deterministic resolver, fail-closed (does not affect UWR scoring); also hosts the deterministic pattern kernel | Support | Bounded, fenced enrichment | | **afi-econ** | Economic research kit (non-canonical) | Research | Not runtime | | **afi-benchkit** | PoI / PoInsight benchmark + reproducibility harness | Research | Standalone benchmark tool | | **afi-artifacts** | Frozen, DOI-minted paper reproducibility bundle | Reference | Frozen snapshot | @@ -165,8 +165,8 @@ Factory is **not** the API Atlas, **not** the Gateway, **not** the Reactor runti - **Two live ingress paths reach the executor.** Most submissions arrive routed from the Gateway (`POST /api/v1/signals` → the Reactor webhook). The Reactor also exposes **`POST /api/ingest/cpj`**, a direct community-provider-journal ingest (`afi.cpj.v0.1`, for Telegram/Discord oracle providers) that bypasses the Gateway under an optional shared secret, validates CPJ v0.1, and deduplicates by ingest hash (`409` on a duplicate). Both paths **resolve the provider → strategy binding** against the boot-validated provider-binding registry — an unbound provider is rejected with an honest `403`, never a silent default composition — then map to USS v1.1 and run the identical scoring path. - **The direct CPJ route is an internal trusted service boundary, not a public API (Reference/Reserved).** Its authentication is optional (a single shared secret) and provider identity is self-asserted, so any future public or partner CPJ access is designated to be mediated by a separate authenticated **Institute oracle-ingress reference service** — designated, **not implemented or deployed** — or another conforming external trust boundary; the route is neither renamed, moved, nor exposed. Provider binding, CPJ validation, and provenance stay mandatory regardless of exposure (ingest dedupe is opt-in, `AFI_INGEST_DEDUPE=1`) (INST-GOV; see [`specs/AFI_RESEARCH_INSTITUTE_REFERENCE_SERVICES.v0.1.md`](specs/AFI_RESEARCH_INSTITUTE_REFERENCE_SERVICES.v0.1.md)). - The **graph is manifest-driven**, not a hardcoded DAG. The executor runs topological waves (Kahn's algorithm) with bounded concurrency, deterministic ready-sets, per-node timeout and retry, conditional edges, and joins keyed by node id. Graph validation enforces unique ids, acyclicity, reachability, exactly one non-bypassable scorer sink, and declared joins. -- The **five analysis categories** are vendor-neutral, provider-instance-backed lane plugins bound at build time, alongside the five-category join plugin and the scorer. Any registered strategy (for example the "Froggy trend-pullback" scorer) is an ordinary registry entry, not a special path. The `aiMl` lane joins the sibling lanes' outputs and invokes the self-hosted `afi-tiny-brains` service through its governed adapter; its result is read-only context and **does not affect UWR scoring** (a failed lane settles under its declared failure policy as a recorded degradation — nothing is fabricated). -- The **bounded provider-adapter runtime** inside the Reactor, below the category node (not a second executor), is the **sole live enrichment-execution seam** (FLPR-GOV). Boot loads the governed `registries/{providers,provider-instances,credential-refs}` records fail-closed; every lane node carries a non-secret `providerInstanceRef`; the runtime resolves the tenant-scoped provider instance, resolves **only** the authorized credential through an injected least-privilege `SecretResolver` (the adapter receives a bounded credential bundle, never a resolver), invokes the trusted statically registered adapter, and validates the canonical `afi.enrichment..v1` output before it reaches the scorer — one resolved result per category, fail-closed at every boundary, no silent provider fallback. Eight adapters are registered: keyless local technical, first-party candlestick pattern (local kernels), Tiny-Brains pattern (self-hosted STUMPY/ruptures/find_peaks), keyless CFTC-COT sentiment (public domain), credentialed Coinalyze sentiment (BYOK header), credentialed NewsData news (BYOK header), keyless SEC-EDGAR news, and first-party Tiny-Brains aiMl. The committed reference profile selects an all-five keyless/self-hosted instance set; selecting a different supported provider is a registry/record change, never category-node code. Credentials are resolved only at invocation and appear in no artifact, log, hash, or evidence; the current resolver backend is the env-backed development backend, and deployment-specific secret backends are pending a later staging wave (PBF-GOV + FLPR-GOV; see [`specs/AFI_PROVIDER_BYOK_FOUNDATIONS.v0.1.md`](specs/AFI_PROVIDER_BYOK_FOUNDATIONS.v0.1.md)). +- The **five analysis categories** are vendor-neutral, provider-instance-backed lane plugins bound at build time, alongside the five-category join plugin and the scorer. Any registered strategy (for example the "Froggy trend-pullback" scorer) is an ordinary registry entry, not a special path. The `aiMl` lane joins the sibling lanes' outputs and invokes the self-hosted `afi-tiny-brains` service through its governed adapter, naming the ProviderInstance-selected orchestration profile (the governed `model` field) and carrying the technical lane's real close-price series; Tiny Brains runs that profile's approved internal experts (Chronos-Bolt forecaster + deterministic trend baseline behind `froggy-reference-v1`) through a deterministic resolver into exactly one result. Its result is read-only context and **does not affect UWR scoring** (a failed lane, unknown profile, unready model, or invalid expert output settles under the declared failure policy as a recorded degradation — nothing is fabricated). +- The **bounded provider-adapter runtime** inside the Reactor, below the category node (not a second executor), is the **sole live enrichment-execution seam** (FLPR-GOV). Boot loads the governed `registries/{providers,provider-instances,credential-refs}` records fail-closed; every lane node carries a non-secret `providerInstanceRef`; the runtime resolves the tenant-scoped provider instance, resolves **only** the authorized credential through an injected least-privilege `SecretResolver` (the adapter receives a bounded credential bundle, never a resolver), invokes the trusted statically registered adapter, and validates the canonical `afi.enrichment..v1` output before it reaches the scorer — one resolved result per category, fail-closed at every boundary, no silent provider fallback. Eight adapters are registered: keyless local technical, first-party candlestick pattern (local kernels), Tiny-Brains pattern (self-hosted STUMPY/ruptures/find_peaks), keyless CFTC-COT sentiment (public domain), credentialed Coinalyze sentiment (BYOK header), credentialed NewsData news (BYOK header), keyless SEC-EDGAR news, and first-party Tiny-Brains aiMl (internal orchestration selected per instance via the governed `model` field, validated against the provider record's `supportedModels`). The committed reference profile selects an all-five keyless/self-hosted instance set; selecting a different supported provider is a registry/record change, never category-node code. Credentials are resolved only at invocation and appear in no artifact, log, hash, or evidence; the current resolver backend is the env-backed development backend, and deployment-specific secret backends are pending a later staging wave (PBF-GOV + FLPR-GOV; see [`specs/AFI_PROVIDER_BYOK_FOUNDATIONS.v0.1.md`](specs/AFI_PROVIDER_BYOK_FOUNDATIONS.v0.1.md)). - The scorer node wraps afi-core's analyst, resolves the UWR configuration fail-closed, and emits scores and their resolved source verbatim. - The Reactor **constructs Evidence V2** (`afi.scored-signal-evidence.v2`) with `lifecycleState = SCORED`, `finalized = false`, the registry-backed UWR-profile stamp, and a required all-or-nothing composition reference. Scores are read verbatim from afi-core and never recomputed. - The **submitter rejects any non-`SCORED` record**, proves the wrapper, schema, sub-artifact schemas, and identifier continuity before submitting, and surfaces every failure as a typed non-2xx. The Reactor **never touches MongoDB directly**; it consumes afi-infra's store as a typed dependency, and persistence is a required step of the run. @@ -304,9 +304,9 @@ Exactly **two** Districts are formally registered (`authority-districts-v0.1`, P | `pattern` | `afi.enrichment.pattern.v1` | `afi-instance-reference-pattern-candlestick` (first-party local kernels; the D-FLPR-3 candlestick block) | `afi-instance-reference-pattern-tiny-brains` (self-hosted kernel service) | **yes** (pattern confidence) | | `sentiment` | `afi.enrichment.sentiment.v1` | `afi-instance-reference-sentiment-cftc-cot` (public-domain COT positioning) | `afi-instance-byok-sentiment-coinalyze` (BYOK header) | wired into the scorer input but inert under the live value domains | | `news` | `afi.enrichment.news.v1` | `afi-instance-reference-news-sec-edgar` (public filings) | `afi-instance-byok-news-newsdata` (BYOK header) | no (evidence/lenses only) | -| `aiMl` | `afi.enrichment.aiml.v1` | `afi-instance-reference-aiml-tiny-brains` (self-hosted service) | — | no (read-only context; evidence/lenses only) | +| `aiMl` | `afi.enrichment.aiml.v1` | `afi-instance-reference-aiml-tiny-brains` (self-hosted service; `model: froggy-reference-v1` selects the internal orchestration profile) | — | no (read-only context; evidence/lenses only) | -All five categories execute live through the provider runtime: the registered `froggy-trend-pullback v1.1.0` manifest binds an explicit `providerInstanceRef` on every lane node (the committed all-five keyless/self-hosted reference profile), and provider selection is a registry/record change under FLPR-GOV D-FLPR-4 — never category-node code, never an environment switch, never a silent fallback. +All five categories execute live through the provider runtime: the registered `froggy-trend-pullback v1.2.0` manifest binds an explicit `providerInstanceRef` on every lane node (the committed all-five keyless/self-hosted reference profile), and provider selection is a registry/record change under FLPR-GOV D-FLPR-4 — never category-node code, never an environment switch, never a silent fallback. **District map authority.** No canonical API Atlas exists and none is started (ATLAS-GOV reserved). District authority and the accepted decision chain — the Part D prose registry as amended — remain the current District map; a future Atlas will describe real District capabilities and interfaces, not define or execute them. No machine-readable District registry exists; creating one belongs to ATLAS-GOV.