"Don't look. Observe."
EYENET is the attribution engine sibling of DECNET, and the consumer of the BEHAVE-TEXT observation framework. Where BEHAVE-TEXT measures, EYENET concludes.
EYENET observes threat actors across chat-style channels (Telegram first; forums, IRC, Matrix, Discord later) and produces:
- Actor profiles (stylometric + lexicometric signatures, role classification).
- Linkage proposals (cross-account, cross-platform identity links).
- Threat graphs over the relation set:
- Actor ↔ Actor (intra-platform and cross-platform)
- Actor ↔ Group
- Group ↔ Group
- Message ↔ Message (quote/reply/forward chains)
- Actor ↔ Infrastructure (handles, wallets, PGP keys, domains)
EYENET does not redefine BEHAVE-TEXT primitives. It consumes actor.observation.text.* envelopes and emits attribution.* events.
Out of scope (v0): active engagement, takedown coordination, automated reporting to platforms.
┌─────────────┐ raw msg ┌─────────┐ observation ┌────────┐
│ Collectors ├─────────────▶│ Sensors ├───────────────▶│ Engine │
│ (fleet) │ raw.message.*│ (fleet) │actor.obs.text.*│ │
└──────┬──────┘ └─────────┘ └────┬───┘
│ │ attribution.profile.*
┌──────▼──────┐ ▼
│ Identity │ ┌─────────┐
│ Pool │ │ Linker │
└─────────────┘ └────┬────┘
│ attribution.linkage.proposed
▼
┌─────────┐
│ Graph │
└─────────┘
| Tier | Responsibility | Cardinality | Consumes | Emits |
|---|---|---|---|---|
| Collectors | Pull raw messages from a source. One process per (source, identity) pair. |
1..N | (external) | raw.message.{source}.{instance} |
| Sensors | Run BEHAVE-TEXT primitives over raw messages. Stateless workers; horizontal-scaled by primitive group. | 1..N | raw.message.* |
actor.observation.text.* |
| Engine | Aggregate observations into actor profiles. | 1 (sharded by actor_id later) |
actor.observation.text.*, identity.label.applied |
attribution.profile.candidate, attribution.profile.current |
| Linker | Compute cross-actor similarity, propose identity links. | 1 (sharded later) | attribution.profile.current |
attribution.linkage.proposed |
| Graph | Persist nodes/edges; serve graph queries. | 1 | attribution.profile.*, attribution.linkage.* |
(query API) |
Cardinality is a first-class concern. Collectors and Sensors are designed as fleets from day one — every interface assumes N instances. Engine, Linker, Graph start as singletons but their consumer-group subscriptions are designed so sharding is an ops change, not a redesign.
All services are independent processes communicating over the bus. No service holds a reference to another service's storage.
Scoping rule (small-operator friendly): One collector process owns one identity, and one identity covers as many groups/channels/forums/threads as that identity has access to. We do NOT spawn a process per Telegram group, per forum thread, or per chat. That would be enterprise-shaped overkill and EYENET is built for the little guy. A single TelegramCollector instance with identity tg_alpha handles ALL channels tg_alpha is joined to, multiplexing them onto the bus.
Plurality exists for two — and only two — reasons:
- Multiple identities on the same source (e.g. two Telegram accounts to widen visibility / reduce per-account rate-limit exposure).
- Multiple sources on the same operator (Telegram + a forum + Matrix).
A typical small-team deployment is 1–3 collector processes total. The fleet abstraction exists so that 3 doesn't require redesign to become 5, not so we shard everything.
CollectorBasedefines the abstract factory; concrete implementations:TelegramCollector(v0),MatrixCollector,IRCCollector,DiscordCollector,ForumCollector(HTTP-scrape),RSSCollector, etc.- Baseline
health() -> CollectorHealthis required onCollectorBasefrom day one. The supervisor is deferred (below), but addinghealth()later forces a retrofit on every concrete collector.CollectorHealthreports:state(one ofstarting,running,cooling,rate_limited,degraded,stopped),identity_name,last_message_at,messages_in_last_hour,current_subscriptions(e.g. group ids it's tailing),last_error(nullable). The shape is part of thecontracts/collector.pyinterface and tested by the contract test suite. - A Collector Supervisor is deferred until the fleet exceeds ~3 processes. v0 ships without one — the operator launches collectors manually (systemd units or
nohup). When the supervisor lands, it callshealth()over the bus (eyenet.control.collector.{instance_id}.healthrequest/reply). - Collectors emit on
raw.message.{source}.{instance_id}. Theinstance_idis derived from a hash of the identity, never the identity itself. Subscribers downstream filter on{source}(e.g.raw.message.telegram.>), not on per-chat granularity. instance_idconstruction — pinned.instance_id = sha256(identity_name + "::" + source_kind).hexdigest()[:8](8 hex chars / 32 bits, collision-safe at fleet sizes ≪1000). No salt. The same(identity_name, source_kind)MUST produce the sameinstance_idon every operator workstation so audit trails correlate across hosts. The formula is documented in thecontracts/collector.pyinterface docstring and asserted by a contract test that fixes a known input/output pair. Two collector implementations diverging on this hash silently breaks bus-subject filtering and OPSEC correlation — treat it as a load-bearing constant.
- Sensors are stateless (no per-actor state — that's the Engine's job). They subscribe to
raw.message.>as a NATS queue group, so messages are load-balanced across sensor instances. - v0 ships ONE sensor process running all primitives. Splitting by primitive group (
stylometric-sensor,lexical-sensor) is allowed but only earns its keep when a primitive becomes expensive enough to need its own process — small-operator deployments will likely never need this. The queue-group design means scaling out is "launch a second sensor"; no redesign required.
- Transport: NATS core (pub/sub) for v0. JetStream enabled for durable streams when replay is needed (Engine restart, Linker reprocessing, Graph rebuild).
- Deployment: single
nats-server -jsbinary. Embedded in-process for dev fixtures; standalone for prod. - Abstract factory:
Businterface withpublish(subject, payload),subscribe(subject, handler, queue_group=None),request(subject, payload, timeout). NATS is the only implementation in v0; the interface exists so we can swap if NATS fails us. - Subjects (topic taxonomy):
raw.message.{source}.{instance_id}— raw collected messages (ref to message store, not body).actor.observation.text.{primitive_namespace}— BEHAVE-TEXT observations (stylometric,lexical,temporal_evolution,interaction,network,content).identity.label.applied— user-supplied ground-truth labels.identity.engagement.authorized— user-authorized engagement registry.attribution.profile.candidate— engine-emitted candidate profile.attribution.profile.current— engine-emitted current best profile per actor.attribution.linkage.proposed— linker-emitted cross-actor link proposals.eyenet.audit.{service}— internal audit log stream (see §9 Logging).eyenet.control.{service}.{instance_id}— control plane (e.g.eyenet.control.collector.tg_alpha.shutdown).
EYENET is Contract-Driven. Every inter-service exchange is defined as a versioned schema BEFORE the producing or consuming service is implemented. Tests are written against the contract, not the implementation.
- Location:
/contracts/directory at repo root. - Format: Pydantic v2 models + JSON Schema export (machine-readable for non-Python consumers).
- Versioning:
schema_versionfield is mandatory on every envelope. Breaking changes increment major; additive changes increment minor. Old versions remain valid for one major cycle. - Source of truth for observations:
decnet_behave_text.spec.Observation. We import it; we do not redefine it.
Surface column distinguishes models that ride the bus (bus), models that are DB rows but never published (db), and models that are both with distinct envelope/row shapes (bus+db). DB-only models still need versioned Pydantic schemas (used by storage layer + migrations); they just don't define a NATS subject.
| Contract | Owner | File | Surface |
|---|---|---|---|
RawMessage |
EYENET | contracts/raw_message.py |
bus+db |
Observation (re-export) |
BEHAVE-TEXT | imported | bus+db |
IdentityLabel |
EYENET | contracts/identity.py |
bus+db |
EngagementAuthorization |
EYENET | contracts/identity.py |
bus+db |
ProfileCandidate |
EYENET | contracts/attribution.py |
bus |
ProfileCurrent |
EYENET | contracts/attribution.py |
bus+db (DB row = Profile, MODELS §2.4) |
LinkageProposed |
EYENET | contracts/attribution.py |
bus |
Linkage |
EYENET | contracts/attribution.py |
db (MODELS §2.5) |
Persona |
EYENET | contracts/attribution.py |
db (MODELS §2.6) |
Membership |
EYENET | contracts/social_graph.py |
db (MODELS §2.2) |
InfrastructureArtifact |
EYENET | contracts/infrastructure.py |
db (MODELS §2.7) |
ActorArtifact |
EYENET | contracts/infrastructure.py |
db (MODELS §2.8) |
Attachment |
EYENET | contracts/message.py |
db (MODELS §2.9) |
ActorAliasHistory |
EYENET | contracts/actor.py |
db (MODELS §2.10) |
GroupSnapshot |
EYENET | contracts/group.py |
db (MODELS §2.11) |
Case |
EYENET | contracts/case.py |
db (MODELS §2.15) |
SystemUser |
EYENET | contracts/system_user.py |
db (MODELS §2.17) |
AuditEvent / AuditLog row |
EYENET | contracts/audit.py |
bus+db (hash-chained, MODELS §2.14) |
SystemLog row |
EYENET | contracts/syslog.py |
db (MODELS §2.18) |
Bus interface |
EYENET | contracts/bus.py |
— |
Storage interface |
EYENET | contracts/storage.py |
— |
IdentityPool interface |
EYENET | contracts/identity_pool.py |
— |
CollectorBase interface |
EYENET | contracts/collector.py |
— |
SensorBase interface |
EYENET | contracts/sensor.py |
— |
/contracts/ is the schema directory, not the bus directory. The Surface column governs whether a NATS SUBJECT constant + envelope wrapper is generated for a given model. Surface=db models are SQLModel rows accompanied by a Pydantic schema for validation/migrations only — they MUST NOT export a SUBJECT symbol or subject() helper, and they are NEVER published to the bus. Surface=bus+db models export both: a wire envelope shape (subject-bearing) AND a persisted row shape, with shared identifiers but distinct schemas (see §4 of MODELS.md).
Contract-test gate: for every model with Surface=db, the contract suite asserts that no SUBJECT constant or subject() helper is exported from its module. For every model with Surface=bus or bus+db, it asserts that exactly one SUBJECT constant is exported and matches the taxonomy in §3. A future maintainer cannot accidentally publish Persona or Case to NATS — the build refuses.
EYENET is operator-grade, not consumer-privacy-minimized. The rule is mechanical:
- Bus envelopes carry hashes/aggregates only.
MessageStoreholds bodies. Transport choice driven by fanout and BEHAVE-TEXT envelope shape — not a privacy fence. evidence_refis dereferenceable by Engine, Linker, Graph, operator UI/CLI. Resolve it whenever context is needed.- Every dereference outside the producing Sensor emits
eyenet.audit.evidence_accesscarryingservice,instance_id,system_user_id(if applicable),evidence_ref,reason. Audit, don't restrict. - Actor join keys are opaque hashes (
actor:<sha256(source_kind||platform_userid)>, see MODELS §0). Handle/display name live in the message store; freely retrievable. - Never on the bus, ever: identity-pool secrets (session files, proxy creds), age/encryption keys. Disk-only, encrypted, per-collector.
- Targeting/intent context (
content.targeting_language,content.transactional_language,content.boasting_pattern, ...) is a first-class observation namespace. Experimental caveat from BEHAVE-TEXT applies — weight skeptically.
| Tier | Contents | Backend (v0) | Retention |
|---|---|---|---|
| Hot | Active corpora, open profiles, recent observations, graph state | SQLite + sqlite-vec | bound to Case.state (see below) |
| Cold | Closed-case messages, historical observations | Compressed NDJSON / Parquet on disk | configurable, default 1 year |
| Archived | Evidence-grade, encrypted (age) | Out-of-band volume | indefinite, manual access |
Hot → cold trigger. Hot-tier residency is bound to Case.state (MODELS §2.15). When ALL Case rows referencing an actor_id (via Case.actor_ids) have transitioned to closed, that actor's messages and observations become eligible for cold-tier migration after a configurable grace period (default 30 days from the latest Case.closed_at). Orphan data — actors/messages with no Case reference — stays hot until manually archived; we do NOT auto-evict on age alone, because an unreferenced actor may simply not have an investigation opened yet. Migration is operator-triggered via CLI; nothing auto-deletes. Reverse migration (cold → hot) is supported when a closed Case is reopened.
Attachment binaries: v0 default is OFF — Attachment rows (MODELS §2.9) capture metadata (mime, size, sha256, filename) but the binary is NOT downloaded or stored. Per-Case opt-in flips retention on; binaries then land at <data_dir>/attachments/<sha256[:2]>/<sha256> with Attachment.storage_uri pointing to that path. S3-compatible object storage is post-v0; the path-string field is forward-compatible.
Storage interface with separate sub-interfaces:
MessageStore— raw messages byevidence_ref.CorpusStore— append-only per-actor message history.ObservationStore— observations indexed by(actor_id, primitive, ts).ProfileStore— current + historical profile states.VectorIndex— similarity search over hash/vector primitives (sqlite-vec for TF-IDF; flat SQL Hamming for simhashes until ~1M signatures).GraphStore— nodes + edges with typed relations.
v0 implementation: all backed by SQLite. Backend dispatched by EYENET_STORAGE_TYPE (default sqlite); MySQL / MariaDB / Postgres concrete impls drop in without ABC churn. The Store ABCs at eyenet/contracts/storage.py stay backend-agnostic.
Two-DB physical layout (M9.1a.2a). EYENET deploys with two physical databases per backend:
-
main— every operational table (messages, observations, profiles, linkages, personas, graph, syslog, cases, clearance grants, system users, ...). Cross-store SQL joins are FIRST-CLASS here. Atomic multi-row writes span any operational table in one transaction. Stores remain logical groupings (one Python class owns each table family) but share one physical engine. -
audit— hash-chained append-only forensic evidence:audit_logtoday, plusfile_access_journal,file_access_acknowledgment,system_user_signing_pubkey_historyonce M9.1c lands. Physically isolated frommainso the forensic record stays tamper-evident even if the operational DB is compromised. Crossings INTOauditare application-layer — audit is a write target, not a read source for normal queries.
History. The pre-M9.1a posture was 8 separate SQLite files per concern with a strict "no cross-store joins" rule. The original rationale was SQLite single-writer concurrency, which does not apply to MySQL/MariaDB/Postgres. With backend-agnosticism on the table, we collapsed the 7 operational stores into main to enable native cross-joins and cross-store atomicity; the audit-isolation guarantee (the only forensically load-bearing piece) is preserved.
Linkage table constraint. Per MODELS §2.5, store the unordered pair as (actor_a_id, actor_b_id) with the invariant actor_a_id < actor_b_id (lexicographic on UUIDv7). Enforced at the DB layer with a CHECK constraint AND in the contract __init__ validator. Insertion code MUST sort the pair before write; this prevents duplicate (A,B) / (B,A) linkage rows.
Linkage table constraint. Per MODELS §2.5, store the unordered pair as (actor_a_id, actor_b_id) with the invariant actor_a_id < actor_b_id (lexicographic on UUIDv7). Enforced at the DB layer with a CHECK constraint AND in the contract __init__ validator. Insertion code MUST sort the pair before write; this prevents duplicate (A,B) / (B,A) linkage rows.
Append-only. Each row: (actor_id, ts, evidence_ref, message_length, language).
Cursor model — per-primitive, not per-actor. Sensors track progress in a CorpusCursor table (MODELS §2.16) with composite PK (actor_id, primitive_name) and fields (last_processed_msg_ts, last_processed_msg_id). Different primitives have different windows (some run per-message, some over rolling N-message windows, some over time-bucketed slices) — they MUST NOT share a single ts cursor or fast primitives will skip messages slow primitives haven't seen. The pair (ts, msg_id) disambiguates same-timestamp messages and is the safe restart key.
- Pool config:
identities.tomloutside the repo (gitignored, age-encrypted at rest). - Each entry: session file path, proxy/Tor circuit ID, device fingerprint hash, cooldown window, last-used timestamp.
- Device fingerprint hash — canonical inputs.
device_fingerprint = sha256(json.dumps(tuple, sort_keys=True))over the source-specific tuple below. Two collector implementations MUST produce identical hashes for identical identities or OPSEC correlation breaks silently.telegram:(api_id: int, device_model: str, system_version: str, app_version: str, lang_code: str, system_lang_code: str)matrix:(homeserver_url: str, device_id: str, user_agent: str)irc:(server: str, nick: str, ident: str, realname: str, client_version: str)discord:(client_build_number: int, user_agent: str, super_properties_hash: str)forum/ HTTP-scrape:(user_agent: str, accept_language: str, tls_fingerprint: str)- Unknown source kinds MUST register their tuple shape in
contracts/collector.pybefore merging a concrete collector.
- A collector instance claims an identity for the duration of its run — rotation mid-session is itself a fingerprint.
- Identity isolation is enforced by separate working directories per identity; no shared state between collector processes.
- No two identities share an outbound IP simultaneously.
- Cooldown windows respected (default 6h between sessions for same identity).
- Telegram-specific: TDLib database file is per-identity, never shared.
- Operator-tier kill switch: publishing to
eyenet.control.collector.*.shutdownhalts collectors and rotates pool state to "frozen". A globalEYENET_PANIC=1env oreyenet.control.global.panicdoes the same fleet-wide.
CDD-aligned, four layers.
- Every contract has a property-based test suite (Hypothesis) verifying:
- Round-trip serialize/deserialize.
- Schema-version compatibility (v_n consumer accepts v_n and v_{n-1} producers within the major).
- Required-field exhaustiveness.
- Gate: no service merges without passing the contract tests for every contract it touches.
- Each service tested in isolation with the bus mocked (the
Businterface makes this trivial). - Collector: source SDK mocked; assert
RawMessageenvelopes emitted are well-formed and carry the correctinstance_id. - Sensor: deterministic input message → expected observation envelope.
- Engine: sequence of observations → expected profile transition.
- Linker: pair of profiles → expected linkage score and decision.
- Use embedded NATS or a
MemoryBusimplementation of theBusinterface. - Run two-or-more services together over a fixture corpus.
- Multi-collector tests are first-class: spin up 2+ collectors with distinct identities, verify no
instance_idcollisions, no shared state, no cross-talk on outbound network mocks. - Verify end-to-end topic flow:
raw.message.*→actor.observation.text.*→attribution.profile.*→attribution.linkage.proposed→ graph state.
- Spawn a real
nats-server -js(testcontainers or local binary). - Run all services as separate processes.
- Replay a recorded fixture corpus (sanitized Rutify subset, redacted).
- Assert eventual graph state matches the expected snapshot.
tests/fixtures/corpora/synthetic_*.jsonl— generated, deterministic, no PII.tests/fixtures/corpora/rutify_redacted.jsonl— small, hand-redacted ground-truth subset (under access control;.gitignored).- Generated personas with known stylometric signatures for ground-truth attribution tests.
Separate test class (tests/calibration/), excluded from default pytest:
- Within-author Hamming distance distribution.
- Cross-author Hamming distance distribution.
- AUC for each primitive's discrimination power on the labeled corpus.
- Regression budget: a primitive's discrimination AUC may not drop more than 5% across a release.
Tracing is developer/debug instrumentation in v0. It is full-fat, 100%-sampled, and rich. Performance cost is accepted in exchange for being able to debug any of the 20+ primitives in isolation. We can dial it back when the primitive suite is stable; not before.
The trace is a vertical lineage that grows as the message moves up the stack. Every service inherits the parent's span context and adds its own attributes on a new child span. By the time a attribution.linkage.proposed event lands in the graph, its trace tree carries — readable end-to-end — every fact that produced it: which message, from which group, fetched by which collector identity, sensed by which primitives with which intermediate values, profiled into which delta, scored against which other actor.
If anything breaks at any layer, the trace tells you which message, which primitive, which input caused it. No bisection. No "which of the 20 primitives is silently returning garbage today?"
- Every envelope on the bus carries a
trace_contextfield (W3Ctraceparent+tracestate). - The Collector starts the root span at message fetch. Every downstream service's first action on receiving an envelope is to extract
traceparentand open a child span under it. - Span links (not just parent-child) are used when a service merges multiple inputs (e.g. Linker comparing two actors → one span with links to both source-profile spans).
| Attribute | Example | Notes |
|---|---|---|
service.name |
collector |
constant |
service.instance_id |
tg_alpha_8f3c |
hash-derived, never the raw identity |
collector.source |
telegram |
source type |
collector.identity_hash |
<sha256> |
for correlation, not the identity itself |
collector.proxy_circuit |
tor:circuit_id |
optional, opaque |
source.chat_id |
-1001234567890 |
Telegram chat / forum thread id |
source.chat_title |
"Rutify Buyers" |
human-readable; helpful for triage |
source.chat_type |
group, channel, dm, forum_thread |
|
message.id |
12345 |
platform-native message id |
message.evidence_ref |
telegram:-1001234567890:12345 |
dereferenceable handle |
message.length_chars |
247 |
|
message.length_words |
42 |
|
message.has_attachment |
true/false |
|
message.is_forward |
true/false |
|
message.reply_to_id |
12340 |
nullable |
actor.id |
actor:<sha256(telegram||userid)> |
opaque join key |
actor.platform_userid |
1234567 |
retained — operator-grade evidence |
actor.handle |
@somehandle |
retained |
actor.display_name |
"Some Name" |
retained |
time.message_sent |
ISO8601 | platform timestamp |
time.collected |
ISO8601 | when EYENET fetched it |
time.lag_seconds |
12.4 |
collected − sent |
Wraps the per-primitive children. One per (message, sensor instance) pair.
| Attribute | Notes |
|---|---|
service.name |
sensor |
service.instance_id |
sensor_default or stylometric-sensor etc. |
sensor.primitive_count |
how many primitives ran on this message |
sensor.corpus_window_size |
sliding window in messages used for this evaluation |
sensor.primitives_succeeded |
count |
sensor.primitives_failed |
count |
| (inherits) | actor.id, message.evidence_ref propagated for ergonomic querying |
One span per primitive computation. This is the load-bearing span for debuggability: when something breaks among 20+ primitives, you see exactly which one and with what input.
| Attribute | Example | Notes |
|---|---|---|
primitive.namespace |
stylometric, lexical, interaction, ... |
BEHAVE-TEXT top-level group |
primitive.name |
function_word_distribution_top50 |
BEHAVE-TEXT primitive |
primitive.version |
0.2 |
implementation version |
primitive.value_kind |
hash, numeric, enum, array |
per BEHAVE-TEXT registry |
primitive.value |
<simhash hex> or 0.42 or proper |
the computed observation value |
primitive.input_token_count |
127 |
what the primitive saw |
primitive.input_corpus_cursor |
actor:abc:msg_847 |
corpus position used |
primitive.duration_ms |
12.7 |
for perf hotspots |
primitive.cache_hit |
true/false |
when applicable |
primitive.warning_codes |
["short_corpus"] |
non-fatal flags |
primitive.outcome |
ok, skipped, error |
|
primitive.skip_reason |
corpus_too_short |
when outcome=skipped |
error.type / error.message |
(on error) | exception captured, span marked errored |
Failure isolation: a failed primitive marks ITS span as errored and is logged, but does not abort sibling primitives or the parent sensor.dispatch span. A broken primitive is a known operational hazard — it must not poison its 19 neighbors.
| Attribute | Notes |
|---|---|
service.name |
engine |
actor.id |
|
profile.version_before |
|
profile.version_after |
|
profile.delta.primitives_changed |
array of primitive names that moved |
profile.delta.role_signal_before / ..._after |
role recipe transition if any |
profile.candidate_emitted |
true/false |
profile.current_emitted |
true/false |
engine.observations_consumed_this_window |
| Attribute | Notes |
|---|---|
service.name |
linker |
actor.a.id / actor.b.id |
|
linker.method |
function_word_simhash_hamming, char_ngram_hamming, tfidf_cosine, ... |
linker.distance |
numeric |
linker.score |
normalized [0,1] |
linker.decision |
link, nolink, inconclusive |
linker.threshold |
the threshold applied |
| (links) | span-links to both source engine.update_profile spans for the two actors |
| Attribute | Notes |
|---|---|
service.name |
graph |
graph.op |
node_upsert, edge_upsert, edge_remove |
graph.node_type / graph.edge_type |
|
graph.node_id / graph.edge_id |
|
graph.source_event |
attribution.linkage.proposed etc. |
For every primitive on every message we record:
- A
sensor.primitive.*span with full input/output attributes. - A structured log line
event=primitive.evaluatedmirroring the span's key fields (so log-grep works without a trace UI). - On failure: span errored, log at
error, sibling primitives continue.
This means: "primitive X is broken" becomes a one-query investigation — filter spans by primitive.name=X AND outcome=error, see every broken evaluation, every input that broke it, every actor it failed on.
- v0: local OTLP collector → file (NDJSON spans). Cheap, greppable, no infra.
- v1: Tempo or Jaeger when v0 stops scaling for visualization.
- v0: 100% sampling, full attributes. Tracing is a developer tool right now.
- Future: tail-based sampling — keep all traces where
attribution.linkage.proposedis emitted or any span is errored; sample the rest. - Wire the predicate hook NOW. A single
should_keep_trace(root_span, span_tree) -> boolpredicate lives ineyenet.tracing.samplingand is called by the OTLP exporter before write. v0 default:return True. Costs ~30 lines, zero behavior change. When tail-sampling lands, flipping the default is a one-file edit instead of retrofitting every span emitter and exporter wiring.
Every log line:
{
"ts": "2026-05-03T...Z",
"level": "info",
"service": "engine",
"instance_id": "<service-instance-id>",
"trace_id": "<otel trace id>",
"span_id": "<otel span id>",
"event": "profile.updated",
"actor_id": "actor:<hash>",
"fields": { ... }
}- No printf-style messages. Event names are dotted, lowercase, stable.
actor_idand other identifiers are always hashed/opaque in logs; the message store is the only place where mapping back is possible (and audited).instance_iddistinguishes log lines from sibling collectors/sensors in a fleet.
| Level | Use |
|---|---|
debug |
Per-message internal state. Off in prod. |
info |
Lifecycle events: subscribe, publish, profile update. |
warn |
Recoverable: contract version mismatch handled by fallback, identity cooldown hit. |
error |
Unrecoverable for the message: dropped envelope, deserialization failure. |
audit |
Operator-relevant: identity pool state changes, manual label application, kill-switch trigger. |
- Separate stream:
eyenet.audit.{service}on the bus, persisted to theAuditLogtable (MODELS §2.14) AND mirrored to an NDJSON file with0600permissions. - Audit events: identity pool rotation, manual label application, profile override, archive/delete tier transitions, kill-switch, collector start/stop with which identity, evidence dereference, linkage confirm/reject, case open/close, system_user login / permission change.
- Tamper-evidence: every
AuditLogrow is hash-chained —prev_hash = sha256(previous_row.self_hash),self_hash = sha256(canonicalized_fields). Insertion / deletion / edit breaks the chain on a single forward walk. Cheap, append-only-friendly, no fancy crypto. - Retention: never auto-pruned. AuditLog is evidence. Only operator-initiated archive transitions a row out of the hot tier, and the chain is preserved across tiers.
- Audit log is the source of truth for "what did an operator do, and when?"
- stdout JSON → systemd-journald (or container runtime). Firehose tier —
debug,info, per-message chatter. - Audit stream →
AuditLogtable + dedicated NDJSON file,0600permissions. - Curated operational log →
SystemLogtable (see §9.5). - No logs to syslog; no logs to network sinks in v0.
The journald firehose is for grep + tail. It is NOT operator-queryable from inside the app and it bloats fast. Per MODELS §2.18, EYENET also persists a curated subset of structured events to a SystemLog SQLite table — designed for the operator UI/CLI's "show me what's wrong" view.
What lands in SystemLog:
- Every
warnanderrorline. - Lifecycle events on a curated allowlist: service start/stop, identity-pool state change, NATS reconnect, contract-version mismatch handled by fallback, kill-switch trigger.
- Notice-level events deemed operator-visible.
What does NOT land in SystemLog:
debugand mostinfolines — journald only.- Per-message processing chatter — covered by traces (§8).
- Audit events — written to
AuditLog(no double-write).
Allowlist mechanism: event names are dotted, lowercase, stable. The allowlist lives in contracts/syslog.py as a typed enum/set. Emitting an event whose name is on the allowlist routes it to SystemLog in addition to journald. Off-allowlist events go to journald only.
Indexes (MODELS §2.18): (service, level, at DESC) for the operator log view; (stack_hash, at DESC) for "show me all instances of this error."
Retention: rows older than N days (default 90) move to cold tier per §5.1. AuditLog never auto-prunes.
- ✅ All
contracts/*.pyfiles written (undereyenet/contracts/; layout note:/contracts/at repo root in §4.1 becameeyenet/contracts/to match the scaffolded package). - ✅ Companion SQLModel tables under
eyenet/models/(23 tables, sharedSQLModel.metadata; per-store engine routing deferred to M1's storage layer). - ✅ Contract test suite passing —
pytest -m contract46/46 green; default-m "unit or contract"48/48 green. - ✅
decnet-behave-core+decnet-behave-textwired as path-editable via[tool.uv.sources].Observationre-exported, not redefined. - ✅ Build-gate active:
test_surface_gate.pyrefuses Surface=db modules that exportSUBJECT*and Surface=bus modules that don't. - ✅ Pinned constants under contract test:
compute_instance_id(PLAN §2.1),device_fingerprintper-source tuples (PLAN §6.1),Linkageactor_a_id < actor_b_idinvariant, EngagementAuthorization exactly-one-of discriminator, AuditLog hash-chain edit/insert/delete detection. - ✅ This document accepted.
- ✅ Two
Busimpls:NATSBus(eyenet/bus/nats.py) overnats-pyandMemoryBus(eyenet/bus/memory.py) for unit/integration tests. Subject matcher (subjects.py) handles*/>wildcards.BusEnvelopePublisherenforcestrace_contexton every publish and refuses unknown subjects (PLAN §3 taxonomy). - ✅
SQLiteStorageaggregate (eyenet/storage/sqlite.py) — two per-store SQLite files (main.db,audit.db) with WAL + FK pragmas.mainholds every operational table;auditis the isolated tamper-evident evidence boundary. Backend dispatched byEYENET_STORAGE_TYPE(defaultsqlite); MySQL / MariaDB impls drop in without ABC churn. AuditLog hash-chain enforced inside the write transaction; mirrored toaudit.ndjson(mode0600). (Pre-M9.1a.2a posture: 8 files with strict no-cross-join rule — collapsed when backend-agnosticism was added; see §5.2.) - ✅ Telemetry (
eyenet/telemetry/): OTelinit_telemetry, W3C trace context extract/inject, structlog JSON renderer auto-populatingtrace_id/span_id,should_keep_tracepredicate hook (PLAN §8.6, returns True),AuditEmitterfor combined bus + persisted audit emit. - ✅
FileIdentityPool(eyenet/identity_pool/file.py) — TOML reader, claim/release/freeze_all state machine, persisted across restarts.device_fingerprintper-source schemas pinned (PLAN §6.1). - ✅
ServiceBase+run_service(eyenet/service/) — boot order, SIGTERM/SIGINT handlers,service.start/service.stopaudit + syslog. Bus close is caller-owned so co-resident services share one bus. - ✅ Five service skeletons:
TelegramCollectorStub(synthetic envelope producer from JSONL fixture),SensorSkeleton,EngineSkeleton,LinkerSkeleton,GraphSkeleton. Each subscribes to its taxonomy entries and logs receipt; no domain logic yet. - ✅ CLI commands (
eyenet/cli/main.py):collector-run,sensor-run,engine-run,linker-run,graph-run,panic.--memory-busflag for dev-loop convenience. - ✅ Tests: 98 unit/contract green (
pytest -m "unit or contract"), 2 integration green (multi-collector + full-fleet overMemoryBus), 1 e2e gated onEYENET_E2E=1(testcontainers NATS). Mypy strict clean, ruff clean. - ✅ Live smoke:
eyenet engine-run --memory-busboots, emits chainedservice.start/service.stopaudit, exits cleanly on SIGTERM.
- One Telegram collector instance with one identity from the pool.
- Sensors implement stylometric primitives v0.2 (function_word_top50, character_ngram_simhash, distinctive_vocabulary_signature, MATTR).
- End-to-end: real Telegram channel → observations on bus → SQLite.
Primitive → Profile slot mapping (Engine input contract for M3). Engine work in M3 cannot start until this table is pinned, because Profile summary fields (MODELS §2.4) are populated from primitive observations and the recipes consume them downstream:
| Primitive (BEHAVE-TEXT name) | Namespace | Value kind | Profile slot |
|---|---|---|---|
function_word_distribution_top50 |
stylometric |
hash (simhash) | stylometric_summary.function_word_simhash |
character_ngram_simhash |
stylometric |
hash (simhash) | stylometric_summary.char_ngram_simhash |
distinctive_vocabulary_signature |
lexical |
array_str | lexical_summary.distinctive_vocab |
MATTR (moving avg type-token ratio) |
lexical |
numeric | lexical_summary.mattr |
Each Profile.*_summary slot also stores last_observation_id and derived_from_observation_count for explainability (MODELS §2.4). New primitives added later append slots; they do NOT rename existing ones (recipe stability).
- Run two Telegram collectors with two distinct identities concurrently.
- Validate no cross-talk, no shared state, separate trace lineages, separate audit entries.
- Profile recipes from
attribution-recipes.mdplaceholders, starting withlurker_or_observerandbot_or_automated_poster. - Profile current/candidate flow.
- Four new primitives:
message_length,message_length_variance_class,punctuation_style,typo_signature,conversation_initiation_rate. - Engine: per-observation slot mapping, debounced ProfileCurrent, recipe registry.
- Integration test: Collector+Sensor+Engine e2e on MemoryBus, two synthetic actors with known role signals.
- CLI:
eyenet engineupgraded;--fixture/--duration/--dump-profilessmoke mode.
- ✅ Linker (
eyenet/linker/): Comparator Protocol + REGISTRY (comparators/_base.py,comparators/__init__.py); two simhash comparators —function_word_simhash_hamming(default 8 bits) andchar_ngram_simhash_hamming(default 10 bits). Both thresholds are UNCALIBRATED until M5 Rutify; markers in source point at the handoff.hamming64(hex_a, hex_b)in_distance.pyis the shared distance primitive. The Linker drives the per-comparator VectorIndex upsert + nearest-neighbor probe, emitsattribution.linkage.proposedper match, and audit-logs each proposal. - ✅ Graph service (
eyenet/graph/graph.py, 291 LOC): subscribes toattribution.profile.current(Actor node upsert) andattribution.linkage.{proposed,suspected,confirmed,rejected}(LinkedTo edge state machine). On confirm, callsstorage.personas.merge_actors(union-find), upserts the Persona node + BelongsToPersona edges, and emitsattribution.persona.updated. Replay-safe — every handler is idempotent. - ✅ Query API (
eyenet/query_api/): read-only FastAPI app, localhost-default with anEYENET_QUERY_API_ALLOW_PUBLIC=1gate against accidental public bind. Five GET endpoints: actor summary, actor neighbors (typed-edge filter), persona, linkages, graph/stats. No write endpoints — operator decisions stay CLI + audit-logged. - ✅ Storage:
LinkageStore.transition()enforces the PROPOSED → {SUSPECTED, CONFIRMED, REJECTED} state machine,(actor_a_id < actor_b_id)unordered-pair invariant per MODELS §2.5;SQLitePersonaStore.merge_actors()handles forward (Persona.member_actor_ids) + reverse (PersonaMembership) views;GraphStore.upsert_node/upsert_edge/neighbors/edges_by_type/statscover the read & write surfaces. Open Question §11.1 resolved — SQLite-with-edges shipped. - ✅ CLI:
eyenet linker,eyenet graph,eyenet graph-api(eyenet/cli/main.py:341-395). All share--data-dir/--nats-url/--memory-busflags with the M1 service runners.eyenet panic(global control subject) covers M4 services viaServiceBaseinheritance. - ✅ Tests:
369 unit/contract green(uv run pytest), M4 integration tests on MemoryBus —test_linker_e2e.py,test_m4_full_pipeline.py,test_query_api.py— and the newtests/e2e/test_m4_nats_pipeline.pyproving the full propose→confirm→persona walk over real NATS (gated onEYENET_E2E=1; either testcontainersNatsContainerorEYENET_NATS_URLoverride). Mypy strict clean. Ruff clean. Coverage 89.30%. - ✅ Live smoke:
eyenet linker+eyenet graph+eyenet graph-apico-resident against runningnats-server -jsonnats://127.0.0.1:4222.GET /graph/statsreturns the zero-state JSON{"actors":0,"personas":0,"linked_to_edges":0,"belongs_to_persona_edges":0}. SIGTERM cleanly produces pairedservice.start/service.stopaudit rows for both services with a single linear hash chain. - ✅ Thresholds deliberately UNCALIBRATED; M5 Rutify grid is the next consumer.
- ✅ Multi-writer storage hardening:
engines.open_all()holds a POSIXflockon<data_dir>/.eyenet-init.lockto serialize first-time schema init across processes (eyenet/storage/engines.py).SQLiteAuditStore.append()opens a raw DBAPI connection and issues an explicitBEGIN IMMEDIATEso concurrent audit writes from co-resident services serialize at the SQLite RESERVED-lock layer (eyenet/storage/audit.py). Proven bytests/unit/storage/test_init_concurrency.py,tests/unit/storage/test_audit_concurrency.py, andtests/e2e/test_concurrent_boot.py.
Carries forward to M5:
- Calibrate
function_word_simhash_hammingandchar_ngram_simhash_hammingthresholds against Rutify, replaceUNCALIBRATEDmarkers incomparators/_base.py.
- ✅ Calibration package (
eyenet/calibration/, 8 modules + CLI subapp):corpus.py(JSONL ingest + chronological split-halves),interaction.py(per-actor stats),simhash_grid.py(within/cross Hamming + Mann-Whitney AUC + F1/precision-floor sweep),labels.py(TOML schema + corpus-sha256 pinning),recipes_grid.py(recipe threshold search with AND-of-axes groups OR-combined),artifact.py(hash-pinnedCalibrationArtifactdataclass + JSON I/O),cli.py(typer subapp). - ✅ Phase 0.5 — detected language surfaced:
function_word_distribution_top50already encodes the detected language in itsObservation.sourcesuffix (...#es/...#en); slot_mapper now parses it intoProfile.stylometric_summary.function_word_simhash.language. char_ngram inherits from there. Zero DB migration (JSON column). New whitelist_LANGUAGE_SUFFIX_PRIMITIVESkeeps the parse opt-in. - ✅ Phase 0.6 — per-language threshold schema: both simhash comparators expose
slot_language(envelope) -> str | None;LinkerThresholdsgainsfunction_word_simhash_hamming_per_lang: dict[str, int | None](None = "disabled for this language").for_comparator(name, language)returnsint | None; Linker skips the comparator entirely when None. - ✅ Simhash grid against Rutify (Spanish): 73 actors qualifying at
min_messages=50, 59 firing function_word, 46 firing char_ngram. AUC=0.5546 (function_word) and 0.6776 (char_ngram). Maximum achievable precision: 0.118 / 0.333. Operator decision (2026-05-22): disable simhash linker for Spanish entirely.LinkerThresholdsdefault factory ships{"es": None}for both per-lang dicts. Long-term fix isminhash-with-shinglesin BEHAVE-TEXT 0.0.2. - ✅ Recipe grid against 74 labeled actors (73 simhash-qualifying + SangMata_beta_bot, the one confirmed sub-threshold bot):
lurker_or_observer: Pattern A (init_rate <= 0.20) shipped — P=1.000 R=0.400 on labeled set (catches 2 of 5 lurkers — the passive-responder class). Pattern B (msg_per_day <= 2.0 AND span >= 7d) calibrated in M5; wired to live deployment in M5.5 (lifts recall to 1.000 on the labeled set).bot_or_automated_poster: operator-locked axesinit_rate >= 0.95 AND message_length_variance_class == "tight"— P=1.000 R=1.000 against SangMata. inter_msg_cv dropped (event-driven bots fail clockwork gates); MATTR held as future tertiary axis (SangMata=0.49 vs human cohort min=0.82).chatty_member(NEW):msg_count >= 195— P=1.000 R=0.955 calibrated in M5; deployment-unblocked in M5.5 by themeta.total_messagesprimitive populatingtemporal_summary.message_count.
- ✅
UNCALIBRATED_*markers removed: all recipe modules now shipreasoning["calibrated"] = Truewithcalibration_corpus = "rutify-full-2026-05-02".grep -rn UNCALIBRATED eyenet/engine/recipes/ eyenet/linker/comparators/returns zero hits. - ✅ Artifact:
tests/fixtures/calibration/rutify_calibration_baseline.json(4.8KB, self-hash86b4e73a…). Carries corpus sha256, eyenet + behave-text versions, full simhash AUC + sweep + recipe confusion matrices. No message bodies, no usernames — safe to commit alongside the gitignored corpus. Round-tripped via strict-typed_from_dicthelpers (noAny). - ✅ Labels (
rutify_labels.toml, committed): 74 hand-labeled actors.labeler = "claude-opus-4-7-via-anti"per operator policy. Counts: 22 chatty_member / 46 normal / 5 lurker / 1 bot / 0 unknown. - ✅ Calibration test suite: 16 tests under
tests/calibration/(3 stub tests rewritten + 11 new). Covers per-recipe P/R floors, code-vs-artifact threshold consistency, simhash AUC regression budget (5% drop = fail), artifact self-hash integrity, config-vs-baseline disable mirror.pytest -m calibrationgreen. - ✅ CLI:
eyenet calibrate {run, label-helper, report, diff}wired via typer subapp.reportsmoke-tested against the committed baseline. - ✅ Quality gates: 453 default tests + 16 calibration tests green.
mypy --strict eyenet/clean across 128 files.ruff check eyenet/ tests/clean. CSV/TOML/JSON artifacts committed.
Carries forward to M6:
- Implement
LLM-Confirmerservice (subscribes toattribution.linkage.proposed, samples evidence_refs, asks an LLM "same author?", emitsattribution.linkage.{confirmed,rejected}). Becomes the de-facto linker for Spanish until BEHAVE-TEXT minhash-with-shingles lands. - Re-enable simhash linker for Spanish when BEHAVE-TEXT ships
minhash-with-shingles.
- ✅ Eight new sensor primitives under
eyenet/sensor/primitives/meta_*.py—total_messages,corpus_span_days,msg_per_day,active_days,activity_density,first_seen_ts,last_seen_ts,fingerprint_confidence. All share a single corpus-stats kernel (_meta_kernel.py) that derives every field from one pass over per-actor timestamps.fingerprint_confidencecutoffs are EXTRACTOR-DEFINED per the BEHAVE-TEXT 0.1.2 spec; the heuristic ships pinned via source-label suffix#confidence-v1. Edge cases (empty corpus, single-day actor) suppress the Observation per the spec contract. - ✅ PrimitiveSpec extension: new
requires_full_corpus: boolflag — when set,StylometricSensor._compute_primitivepasses epoch sentinels toiter_since, fetching the actor's full history instead of the since-cursor delta. Bodies fetch is also skipped (meta primitives are timestamp-only). Cursors still advance for bookkeeping uniformity. - ✅ Slot-mapper wiring: eight
_SLOT_MAPentries routingmeta.*→temporal_summary.*. Slot key formeta.total_messagesismessage_count(nottotal_messages) to matchchatty_member.REQUIRED_SLOTSverbatim — recipe never had to be edited. - ✅
lurker_or_observerPattern B deployed: second AxisGroup (msg_per_day <= 2.0 AND corpus_span_days >= 7.0) OR-combined with Pattern A. RecipeREQUIRED_SLOTS = ()(empty) because the OR-combinator must run when EITHER pattern's slots are populated — the recipe body has its own per-pattern guards. Labeled-set recall lifts from 0.40 → 1.000 (P stays 1.000). - ✅
chatty_memberdeployed: deployment-blocked banner removed; thresholdmsg_count >= 195now fires on actors whosemeta.total_messagespopulatestemporal_summary.message_count. - ✅ Tests: 18 new unit tests for the kernel + 8 primitives + cross-cutting cases; 8 new parametrized slot_mapper cases; 8 new Pattern B / both-patterns / no-data lurker cases; 1 new calibration regression case asserting Pattern B's msg_per_day + corpus_span_days axes match the artifact. Total: 487 default + 17 calibration green.
mypy --strict eyenet/clean (137 source files).ruff checkclean. - ✅ Live smoke:
eyenet calibrate runon the Rutify corpus reproduces the M5 P/R/F1 figures exactly across all three recipes (lurker 5/0/69/0 P=R=1.000, bot 1/0/73/0 P=R=1.000, chatty 21/0/52/1 P=1.000 R=0.955). Artifactself_hashdiffers from the committed baseline only because of metadata drift that pre-dates M5.5 (behave_text_versionbumped 0.1.1 → 0.1.3 in the operator's environment,corpus_idfilename changed). Calibration math is identical.
Carries forward to M6:
- Re-issue
rutify_calibration_baseline.jsonagainst BEHAVE-TEXT 0.1.3 + the newcorpus_idif/when the operator wants the committed baseline back in self-hash agreement. The M5.5 wiring did not introduce the drift; the baseline simply pre-dates it.
First of four language-agnostic, locale-aware primitives. BCP-47 xx-YY is the universal output; Spanish is the first calibrated language, not the design scope. Adding a second language (English, Portuguese, ...) post-M6 is a matter of registering its marker vocab — no primitive contract changes.
- ✅ INGEOTEC vocabulary corpus committed via git-lfs at
data/ingeotec/voc/*.tsv.gz(27 files × ~2-13MB, regional-spanish-models v1)..gitattributesconfigured (filter=lfs diff=lfs merge=lfs -text); LFS hooks merged into.githooks/pre-pushand newpost-checkout/post-commit/post-merge.data/gitignore restructured todata/*+!data/ingeotec/so the corpus tracks while other data subdirs (storage, attachments) stay excluded. - ✅ Offline marker builder (
scripts/build_regional_markers.py, ~270 LOC): reads INGEOTEC<CC>.tsv.gzfiles, computes exclusivity =freq[region][tok] / sum_all_regions_freq[tok], applies a comprehensive blocklist of TIME-DECAYING proper nouns (politicians, parties, sports clubs, cities, media outlets, Twitter handles), structural acronym filter (length-3 with ≤1 vowel rejected unless in_DIALECTAL_3CHAR_WHITELIST), and emits top-N per region byexclusivity × log(1+ndocs). Default thresholds:excl ≥ 0.70,min_ndocs ≥ 5000,top_n = 80. - ✅ Generated markers (
eyenet/sensor/primitives/_regional_markers.py): 14 BCP-47 regions, 569 total markers. Strong coverage on es-AR (boludo, che, posta, laburo, quilombo, vos, sos, tenes, …), es-CL (weon, altiro, aweonao, callampa, fome, cabros, conchetumare, …), es-MX (chido, chingo, chingon, culero, neta, chinga, …), es-VE (chamo, marico, arrecho, bachaqueo, …), es-ES (cojones, gilipollas, flipando, chaval, ostia, mola, guay, …), es-CO (chimba, bacano, gonorrea, hijueputa, gamin, dizque, …), es-PE (causa, pata, pituco, …). Sparse coverage on es-BO, es-CU, es-PR (low INGEOTEC sample size; revisit when richer corpora land). - ✅ Primitive module (
eyenet/sensor/primitives/dialect_region.py, ~180 LOC):requires_full_corpus=True, MIN_MESSAGES=10, MIN_HIT_RATE=0.001, CONFIDENCE_MARGIN=1.8. Language gate via inline function-word overlap vote (es vs en, ~16 anchors each) — wrong language returnsNone. Below-confidence emitsObservation(value="unknown")per BEHAVE-TEXT 0.1.x spec so downstream can distinguish "undetected" from "not extracted". Source labeleyenet/sensor/primitives/dialect-region:v0.1#dialect-markers-v1. - ✅ Slot wiring (
eyenet/engine/slot_mapper.py):"lexical.dialect_region": ("lexical_summary", "dialect_region"). NOT in_LANGUAGE_SUFFIX_PRIMITIVES(it IS the language/region detector; redundant). - ✅ Tests (
tests/unit/sensor/primitives/test_dialect_region.py, 19 cases): registry contract, requires_full_corpus, language gate (English → None), ambiguous Spanish → unknown, region detection (AR/CL/MX/VE/ES), tied-region margin gate, observation source/confidence shape, slot mapper wiring, marker-set integrity (BCP-47 format, non-empty, single-token). - ✅ Quality gates: 506 unit+contract tests green (was 487, +19 dialect_region).
mypy --strict eyenet/clean across 139 source files.ruff check eyenet/ tests/ scripts/clean. - ✅ Live smoke:
python3 scripts/build_regional_markers.pyreproduces the committed_regional_markers.pybyte-for-byte fromdata/ingeotec/voc/*.tsv.gz.
Carries forward to M6.5:
- Iterative blocklist tuning. The current blocklist catches the bulk of political/sports/city noise but new proper nouns will surface as the operator audits attribution traces. Add to
_NOISE_BLOCKLISTand re-run the builder. - A small residual of names (~5%) still passes the filter; harmless for attribution but worth a periodic sweep.
- ✅ Three primitives sharing a single spaCy tagger pass via
eyenet/sensor/primitives/_locale_morph_kernel.py:stylometric.pos_ngram_signature— 64-bit simhash over UPOS bigram counts. Source label declares tagger + n:#spacy-es_core_news_sm-bi. MIN_TOKENS=200.lexical.evaluative_morphology_density— sum(eval-bucket hits) / NOUN+ADJ count. Buckets: diminutive, augmentative, pejorative, intensive. Range clamped [0, 1] per BEHAVE-TEXT spec. MIN_TARGET_TOKENS=50.lexical.optional_grammar_signature— 64-bit simhash over choice-point bucket counts: compound_past, subjunctive, clitic_le/la/lo, relative_que/cual/quien. MIN_TOKENS=200.
- ✅ spaCy is a CORE dependency (
pyproject.toml), not optional. Operator decision 2026-05-23: EYENET ships small-operator CTI; operators accept the storage cost in exchange for working software out of the box. Thees_core_news_smmodel (~13MB) is auto-fetched on first run by_load_nlp()viaspacy.cli.download, with a structlog audit eventevent=spacy.model_downloaded. spaCy loads withparserandnerdisabled butlemmatizer + attribute_rulerenabled — the optional-grammar rule pack readstoken.lemma_forhaber. - ✅
LocaleRulesetprotocol + registry (eyenet/sensor/primitives/_locale_rules/__init__.py). Spanish ruleset (_locale_rules/es.py) ships first; future English/Portuguese register aRULESETconstant + aRULESETS[code]entry, no kernel changes. Surface-form rules for evaluative morphology (sm lemmatizer preserves diminutives, so lemma-based detection is impossible);token.morph.get("Mood", [])for subjunctive (immune to the sm lemmatizer's irregular-verb mangling, e.g.fuera → fuerir). Blocklist for lexicalized "-ito" / "-azo" / "-ico" surface forms (bonito,escrito,politico, …). - ✅ Shared kernel (
_locale_morph_kernel.py): singlenlp.pipe(batch_size=64)pass yieldsMorphAnalysis(pos_bigrams Counter + evaluative_counts + optional_grammar_counts + token totals + window). All three primitives consume the same analysis. - ✅ Language gate consolidated:
dialect_region(M6) and the M6.5 trio now share_locale_rules/_language_gate.py(is_spanish+detect_languagereturning BCP-47 code). Anchor sets unchanged from M6. - ✅ Slot wiring (
eyenet/engine/slot_mapper.py): three new_SLOT_MAPentries (stylometric_summary.pos_ngram_signature,lexical_summary.evaluative_morphology_density,lexical_summary.optional_grammar_signature). Both simhash primitives added to_LANGUAGE_SUFFIX_PRIMITIVES— they encode#<lang>themselves; the density primitive stays off (numeric, no per-language threshold branch). - ✅ Two new linker comparators (
pos_ngram_simhash_hamming,optional_grammar_simhash_hamming) registered inREGISTRY.LinkerThresholdsships calibrated defaults for Spanish:pos_ngram_simhash_hamming_per_lang = {"es": 10}andoptional_grammar_simhash_hamming_per_lang = {"es": 12}. Calibration logic ineyenet/calibration/artifact.pyscopes the M5 ES-blanket-disable to the M5 primitives only — M6.5 simhashes are exempt. - ✅ Calibration grid extended (
eyenet/calibration/simhash_grid.py): default primitive tuple now includespos_ngram_signature+optional_grammar_signature; both detect their own language via the source-label suffix path (_SELF_LANG_PRIMITIVES). The committedrutify_calibration_baseline.jsonpre-dates M6.5; the nexteyenet calibrate runagainst the corpus will emit grid entries for the new primitives and the M6.5 calibration regression tests will lift to AUC budget assertions. - ✅ Tests: 52 new unit tests (
test_locale_morph_kernel.py22,test_pos_ngram_signature.py11,test_evaluative_morphology_density.py10,test_optional_grammar_signature.py9) + 4 new calibration regression tests (test_simhash_thresholds.py). Total: 558 default + 21 calibration green. Coverage 85.48% (above gate). - ✅ Quality gates:
pytest -m "unit or contract"558 green;pytest -m calibration21 green;mypy --strict eyenet/clean across 148 source files;ruff check eyenet/ tests/ scripts/clean. - ✅ Live smoke: in-process end-to-end (Spanish chat paragraph → all three primitives emit valid Observations with expected source-label suffixes). Auto-fetch of
es_core_news_smverified in a fresh venv.
Fixes pass — round 2 (2026-05-23, same day): honest review found a deeper set of gaps. Closed:
- ✅ Production correctness bug, not just a perf issue. Pre-fix
_compute_primitiveskipped body fetches for ALLrequires_full_corpus=Trueprimitives (gated onif not spec.requires_full_corpus), which silently broke the M6.5 trio end-to-end through the sensor — they gotbodies={}and returned None every time. Fix: addedrequires_bodies: bool = TruetoPrimitiveSpec; meta.* explicitly setrequires_bodies=False; the trio inherits the default True. Now they actually run. - ✅ Sensor-side full-corpus + bodies memo.
_run_primitiveslazily fetches the full corpus + body batch once per actor dispatch and reuses them across the 11requires_full_corpus=Trueprimitives (8 meta + 3 trio). Net savings per actor per dispatch: ~10 fewer SQLite reads and ~10 fewer MessageStore round-trips. - ✅ Kernel cache key tightened. Now includes a bodies fingerprint — defends against the "same evidence_refs, different content" stale-result class of bugs that tests had been masking via UUID-prefixed refs.
- ✅
_KernelStatsdataclass replaces the_NLP_PIPE_CALLSmodule global. Tests readkernel._stats.pipe_calls/cache_hits/cache_misses. The leading underscore signals test-visible-not-API; the additional counters make future debugging cheaper. - ✅ Sensor-integration tests prove the properties end-to-end.
tests/integration/test_stylometric_kernel_memo.pydrives the real sensor dispatch loop with the synthetic_m2 fixture and asserts (a)_stats.pipe_calls <= msg_count— the kernel runs at most once per envelope across the trio, and (b)iter_sinceis called far less thanmsg_count × 11— the storage memo works. - ✅ CI bootstrap.
tests/conftest.pysession-scoped fixture fails-fast with a clear remediation message ifes_core_news_smisn't installed.scripts/install_models.pyis the documented provisioning entry point for CI runners. Production still auto-fetches on first run; CI gets the explicit path. - ✅ pytest-benchmark perf floor.
tests/unit/sensor/primitives/test_locale_morph_kernel_benchmark.py(opt-in viapytest -m benchmark) asserts mean kernel time over 200 messages is under 500ms. Local baseline ~190ms; budget catches >2.5× regressions.
Test count: 566 unit/contract (+1 cache-miss test from round 1's 565) + 18 integration (+2 new from this round) + 21 calibration. mypy --strict clean, ruff clean, coverage 85.43% above the 85% gate. E2E suite (EYENET_E2E=1) green: 3/3 against real NATS via testcontainers.
Fixes pass — round 1 (2026-05-23): earlier honest post-ship review surfaced five gaps that closed in the previous round:
- ✅ Kernel is now genuinely single-pass per actor. Added a module-level single-slot memo to
compute_morph_analysis()keyed on(language, tuple(evidence_refs))— the sensor's per-actor dispatch rebuilds thecorpuslist per primitive, soid()-based memoization wouldn't hit. Across the three M6.5 primitive calls for one actor, spaCy now runs once, not three times. Verified by_NLP_PIPE_CALLS == 1after three back-to-back primitive calls; wallclock for the trio dropped from ~3× kernel cost to ~10ms total in the smoke. - ✅ Auto-fetch branch is exercised by a test.
test_load_nlp_auto_downloads_on_missing_modelmonkeypatchesspacy.loadto raiseOSErroron the first call, intercepts_spacy_download, and asserts the retry path fires exactly once. The OSError → download → retry contract is no longer theoretical. - ✅
evidence_reffalls back to the last in-bodies ref. Newevidence_ref_for(corpus, bodies)helper in the kernel walks the corpus in reverse and returns the most recent ref the kernel actually processed (one that's inbodies). All three primitives use it instead ofcorpus[-1][2]. Three new unit tests cover the trailing-missing-body case + the empty-overlap case. - ✅
_reset_for_testsproperly exported; companion_reset_cache_for_testsadded for cheap between-test isolation (drops memo only, keeps the loaded spaCy model — full_reset_for_testswould multiply test-suite runtime by orders of magnitude). Conftest attests/unit/sensor/primitives/conftest.pyautouses the cache-only reset. - ✅ Gate divergence documented.
_language_gate.pymodule docstring now explains thatis_spanish(loose, tie → True, used by M6dialect_region) anddetect_language(strict, ≥2 anchor hits required, used by the M6.5 trio) intentionally have different thresholds. The next reader won't "fix" the apparent inconsistency. - Test count: 565 unit/contract (was 558, +7 fixes-pass) + 21 calibration; coverage 85.66% (up slightly);
mypy --strict+ruff checkclean.
Calibration completion (2026-05-23, same day): the Rutify re-run landed. Operator decision: both new simhashes DISABLED for Spanish, mirroring the M5 outcome on the existing pair:
| Primitive | AUC | Max precision (any t) | Operator action |
|---|---|---|---|
function_word_distribution_top50 |
0.5546 | 0.118 | M5 disable (unchanged) |
character_ngram_simhash |
0.6776 | 0.333 | M5 disable (unchanged) |
pos_ngram_signature |
0.6108 | 0.200 | M6.5 disable (new) |
optional_grammar_signature |
0.6319 | 0.080 | M6.5 disable (new) |
Neither M6.5 simhash cleared the precision_floor:0.70 strategy at any threshold — same structural ceiling as the M5 simhashes on short Spanish chat. Code changes:
LinkerThresholds.pos_ngram_simhash_hamming_per_lang = {"es": None}LinkerThresholds.optional_grammar_simhash_hamming_per_lang = {"es": None}- Artifact policy
_ES_DISABLED_PRIMITIVESnow includes all four ES-failing simhashes. tests/fixtures/calibration/rutify_calibration_baseline.jsonrefreshed (self_hash=d4aa2e26…,corpus_id=rutify-full-2026-05-02,corpus_sha256=bc0aab18…); recordsenabled=False, chosen_threshold=Nonefor all four ES slices.- Calibration regression tests lifted from wiring-only to AUC budget (5% drop floors: 0.580 pos_ngram, 0.600 optional_grammar) + config-mirror + policy-set membership.
- Three calibrated recipes (
lurker_or_observer,bot_or_automated_poster,chatty_member) re-validated — same P/R/F1 as M5.5 to four decimals.
Final gates: 566 unit/contract + 25 calibration + 18 integration + 3 E2E (real NATS) green. mypy --strict clean (148 files). ruff clean. Coverage 85.43%.
Carries forward (still):
- Re-enable simhashes for Spanish when BEHAVE-TEXT 0.0.2 ships minhash-with-shingles and/or when the LLM-Confirmer service lands. The disable list in
eyenet/calibration/artifact.py::_ES_DISABLED_PRIMITIVESis the swap point. - Wire
evaluative_morphology_densityas arecipes_gridaxis when a recipe wants it. The slot is populated; the recipe consumer doesn't exist yet. Adding the axis requires computing the primitive during calibration ininteraction.pyand adding a newActorStatscolumn — real work, defer until a recipe needs it. - Add an English ruleset (
_locale_rules/en.py) when an English-language corpus lands. The kernel and slot wiring need zero changes — registerRULESET+ aRULESETS["en"]entry.
The point of M7 is to prove the abstract factory holds. Matrix beats Forum/IRC/RSS as the second source because matrix-nio is async-callback-driven like Telethon but the room/event model, auth (access_token vs MTProto session), and ID shapes (@user:server / !room:server / $event_id) are all materially different — making the "factory survives a wildly different SDK" claim much stronger.
- ✅ matrix-nio>=0.24 added as a CORE dep (
pyproject.toml). No[e2e]extra — unencrypted rooms only in v0 (E2EE would addlibolmC compile + per-identity key cache; deferred).mypy.overridesextended withnio.*.coverage.omitextended witheyenet/collectors/matrix/real.py(live-network code path). - ✅
IdentityFileEntryextended (eyenet/identity_pool/loader.py) withmatrix_homeserver_url,matrix_user_id,matrix_access_token,matrix_device_id,matrix_monitor_rooms. All optional — Telegram-only TOMLs round-trip unchanged. New helper_uses_session_file(SourceKind) -> boolscopes the on-disk session-file precheck to Telegram only; Matrix carries auth in the TOML so the existing loader's session_path existence check is now per-source instead of all-or-nothing. - ✅
MatrixCollectorStub(eyenet/collectors/matrix/stub.py, ~95 LOC) mirrorsTelegramCollectorStubline-for-line withSourceKind.MATRIX,evidence_refprefixmatrix:<room_id>:<event_id>, and the same JSONL replay shape. - ✅
MatrixCollector(eyenet/collectors/matrix/real.py, ~320 LOC):AsyncClient(homeserver, user_id, device_id=...)+ pre-provisionedaccess_token— no login round-trip at start.- Room aliases (
#alias:server) resolved to canonical!room_id:serverviaclient.room_resolve_alias.!-prefixed entries pass through. Unknown forms warn and drop. add_event_callback(self._on_message, RoomMessageText)— text events only for M7.m.image/m.fileand other event kinds ignored at the callback level. Encrypted-roomMegolmEvents are silently dropped (not subscribed).- Self-echoes (sender == own user_id) dropped at ingest.
actor_key = "actor:" + sha256("matrix||<user_id>").evidence_ref = "matrix:<room_id>:<event_id>".GroupKind.MATRIX_ROOMon every monitored room.- OPSEC:
set_presence="offline"hard-coded on everysync_forevercall. Matrix has no separate "invisible" presence; "offline" IS invisible. No operator knob — the constant_PRESENCE_OFFLINEis the only allowed value.
- ✅ CLI (
eyenet/cli/main.py) —--typeextended to{telegram-stub, telegram, matrix-stub, matrix}. The legacystubvalue is kept as a deprecated alias that emits a stderr warning + maps totelegram-stub. Session-file precheck now gated oncollector == "telegram"only. - ✅ Backfill via
/messagespagination — opt-in with--backfill. Refuses ifmatrix_monitor_roomsis empty (would otherwise scrape every joined room — sanity stop). One-shotsyncpopulates per-roomprev_batchtokens; the collector then pages backwards in chunks of 100, ingesting text events via the same_ingest_eventpath as live sync. Default per-room limit 1000; configurable viaMatrixCollector(backfill_limit=...). Runs in parallel withsync_forever; MessageStore's unique-evidence_refconstraint deduplicates the overlap. Added 2026-05-23 same day as M7 in response to live-smoke feedback. - ✅ Deferred from Telegram parity (called out, not silent): attachments (text-only —
has_attachment=Falsealways), reply/relation parsing (m.relates_todeferred —reply_to_platform_msgidalways None), E2EE. - ✅ Tests: 15 new unit tests under
tests/unit/collectors/matrix/(contract smoke, identity TOML round-trip, stub envelope shape, real-collector with a fakeAsyncClientexercising on_subscribe, callback wiring, alias resolution, ingest, self-echo drop, presence=offline assertion). 1 new integration testtests/integration/test_two_sources_one_sensor.py— the M7 proof: Telegram + Matrix stubs on a single MemoryBus + sensor, asserts 6 envelopes (3+3), per-source subject partitioning, evidence_ref prefix matching, audit-row isolation acrosscollector.telegramandcollector.matrix. New fixturetests/fixtures/corpora/synthetic_matrix.jsonl. - ✅ Quality gates:
pytest -m "unit or contract"581 green;pytest -m integration19 green (was 18, +1 two-sources);pytest -m calibration25 green. Coverage 86.25% (above 85% gate).mypy --strict eyenet/clean across 151 source files.ruff check eyenet/ tests/ scripts/clean. - ✅ Live smoke:
eyenet collector --identity alpha_mx --type matrix-stub --fixture tests/fixtures/corpora/synthetic_matrix.jsonl --memory-busboots, emits hash-chainedservice.start/service.stopaudit rows undercollector.matrixwith the contract-pinnedinstance_id(4ba08aaffor identityalpha_mx), exits cleanly on SIGTERM.
Carries forward (defer until an operator asks):
- E2EE rooms — wire matrix-nio
[e2e](libolm) and a per-identity key cache when an operator needs to monitor an encrypted room. - Attachments —
m.image/m.fileevents intoAttachmentTablerows. - Reply graph —
m.relates_toparsing intoreply_to_platform_msgid. - Backfill cursor persistence — today's backfill re-paginates from the latest sync token on every restart. MessageStore dedup makes this correct but wasteful on large rooms. Persisted resume tokens (likely a
CorpusCursor-shaped row keyed by(matrix, room_id, "backfill")) when an operator hits a room large enough to feel it.
Third tier between the cheap Linker (signature-pairwise via Comparator)
and the future LLM Confirmer. Operates on raw per-actor corpora, returns
a composite score that promotes PROPOSED → SUSPECTED autonomously.
Fills the Spanish-linkage gap left by M5's blanket-disabled simhashes,
and generalizes beyond it.
- ✅
VerifierProtocol + REGISTRY (eyenet/verifier/verifiers/{_base.py,__init__.py}) — sibling ofComparator.VerificationResult(method, score∈[0,1], confidence∈[0,1], evidence, skipped, skip_reason). Two methods ship:GeneralImpostors(Koppel/Schler, ~200 LOC, n_iters=100 bootstrap subsamples over function-word + char-trigram feature subspaces) andCompressionDistance(NCD via zlib, ~50 LOC, stdlib-only, symmetric concat, 50KB-cap window). - ✅
VerifierService(eyenet/verifier/service.py) —ServiceBasesubclass. Subscribes toattribution.linkage.proposed; dereferences last-N message bodies for both actors via MESSAGES engine; runs REGISTRY; composite = mean of non-skipped scores; if composite ≥composite_floor→LinkageStore.transition(SUSPECTED)+ emitsLinkageSuspectedEnvelope. Audit-emitsverifier.evaluatedper verifier andlinkage.suspectedon promotion. Per-language disable honored viaVerifierThresholds.for_verifier(name, language) -> float | None. - ✅
VerifierThresholds(eyenet/cli/config.py) — mirrorsLinkerThresholds: per-method float floors +<method>_per_lang: dict[str, float | None]overrides +composite_floor+window_messages. M8 ships GI/NCD enabled for all languages (no Spanish disable; the calibration grid will surface AUC). - ✅
FeedbackPairSQLite store (eyenet/models/feedback.py,eyenet/storage/feedback.py) — auto-populated by the existingeyenet linkage confirm(→ground_truth="same") andeyenet linkage reject(→ground_truth="diff") commands.suspectdoes NOT write (still ambiguous). Colocated in the PROFILES engine so thelinkage_idFK resolves natively. Pair-order invariant (actor_a_id < actor_b_id) enforced at both contract and DB layers, mirroringLinkageStore. Idempotent onlinkage_id— operator overrides replace the prior row. - ✅ CLI: new
eyenet verifierpush-mode runner (mirrorseyenet linker).--impostor-poolflag accepts a JSONL fixture; defaults totests/fixtures/calibration/impostor_pool.jsonlif present, falls back to empty pool (GI degrades to plain cosine with confidence=0.3). - ✅ Calibration grid (
eyenet/calibration/verifier_grid.py) — score-higher-is-better mirror ofsimhash_grid. SAME pairs from per-sendersplit_halves, DIFF pairs sampled cross-sender (capped at 5x within count, seeded RNG for reproducibility). AUC viamann_whitney_auc_higher_better, 101-row sweep over [0,1] score thresholds, precision-floor + F1-max pickers.VerifierGridResultmirrorsPrimitiveGridResultfield-for-field. - ✅ Artifact extension (
eyenet/calibration/artifact.py) — schema 1.0 → 1.1 (additive). NewVerifierArtifactEntry+verifiers: tuple[...]field onCalibrationArtifact. New_ES_DISABLED_VERIFIERSsibling set (empty on ship — GI/NCD are designed for short chat). Migration applied to committedrutify_calibration_baseline.json—schema_version="1.1",verifiers=()for the M5/M6.5-era baseline; new self_hash958d347e…. - ✅
eyenet calibrate runwired to emit theverifierssection alongsidesimhashandrecipes.eyenet calibrate reportrenders the new section as a markdown table. - ✅ Tests: 32 new unit tests across
tests/unit/verifier/(5 files: Protocol contract, GI, NCD, VerifierThresholds, _bag) + 4 newFeedbackPairstorage tests + 3 new integration tests (tests/integration/test_verifier_pipeline.py— same-author promoted, diff-author not promoted, short-corpus skip) + 9 new calibration tests (tests/calibration/test_verifier_thresholds.py— synthetic AUC floor, artifact roundtrip, schema 1.1 baseline,_ES_DISABLED_VERIFIERSempty policy). - ✅ Quality gates:
pytest -m "unit or contract"628 green (was 581, +47).pytest -m integration22 green (was 19, +3).pytest -m calibration34 green (was 25, +9).mypy --strict eyenet/clean across 164 source files.ruff checkclean. Coverage 87.38% (above 85% gate). - ✅ Live smoke:
eyenet --helpshows the newverifiercommand. Verifier registry resolves GI + NCD at import; synthetic same/diff corpus separates cleanly (GI same=0.886 / diff=0.013; NCD same=0.569 / diff=0.358). FeedbackPair CRUD verified against a real SQLite file with linkage FK.
Carries forward to M8.5 / M9 (deferred per the operator's M8-scope decision):
- Sentence-transformer cosine verifier (heavyweight; needs operator decision on bundle-vs-BYO model).
- LR fusion (method 5) — gated on ≥50 confirmed pairs in
FeedbackPair. - TOML export of feedback pairs (
eyenet calibrate export-feedback) — only needed when LR fusion lands. - Real Rutify calibration run against the new verifier grid (corpus is gitignored; operator-triggered). Will update
rutify_calibration_baseline.jsonwith non-emptyverifiersentries and may flip_ES_DISABLED_VERIFIERSper the AUC outcome. - Re-enable the four ES-disabled signature simhashes when BEHAVE-TEXT 0.0.2 ships minhash-with-shingles.
Gap-closure pass (2026-05-24, same-day-as-M8): post-ship audit closed:
- ✅ Behavioral bug — language propagation.
VerifierService._extract_languagereadevidence["language"]but the Linker never put it there. Fix ineyenet/linker/linker.py::_emit_proposalinjectsslot_languageinto the proposal evidence dict. Per-language disable path is now reachable at runtime. New unit teststests/unit/linker/test_language_propagation.pycover the propagation + the no-language case. - ✅ Stable linkage_id across bus + DB. Linker minted a fresh UUID for the bus envelope while
insert_proposedminted a different one for the DB row — silently mismatched. Verifier transitions failed with "linkage not found" the first time anything tried to chain on the wire ID.LinkageStore.insert_proposednow accepts an optionallinkage_id; Linker passes its envelope ID. Persist-before-publish ordering added to defeat the read race on real NATS. - ✅
FeedbackPairRowPydantic schema (eyenet/contracts/feedback.py) — sibling to the SQLModelFeedbackPairTable, mirrors the LinkageRow / LinkageTable split. Enforcesactor_a_id < actor_b_idandground_truth ∈ {"same","diff"}at the contract layer. Surface-gate test registers it as Surface=db.FeedbackPairStoreABC return types narrowed fromobjecttoFeedbackPairRow; SQLite impl converts at the boundary via_row_to_contract. - ✅ CLI integration tests (
tests/integration/test_linkage_cli_feedback.py) —CliRunneragainsteyenet linkage {confirm,reject,suspect}asserting state machine + FeedbackPair side-effects + terminal-state refusal. - ✅ E2E test against real NATS (
tests/e2e/test_m8_nats_pipeline.py, gated onEYENET_E2E=1) — propose→verify→suspected over wire for same-author corpora; no-promotion for diff-author. Confirmed running againstnats://127.0.0.1:4222. - ✅ Synthetic impostor pool at
tests/fixtures/calibration/impostor_pool.jsonl— 12 actors × 30 messages across 6 Spanish + 6 English style buckets. GI now runs with confidence=1.0 out of the box (was degraded to confidence=0.3 plain-cosine fallback). Loader autopicks the path when--impostor-poolis unset. - ✅ Verifier syslog on promotion (#5) — closed as no-op for codebase consistency. Linker and Graph don't syslog linkage state-machine events either; the convention is audit-only for that signal class. Documented inline.
- ✅ Final gates: 634 unit/contract, 26 integration (+4 CLI feedback), 34 calibration, 5 E2E (2 new M8 + 3 prior). Coverage 87.45%.
mypy --strictclean across 165 files.ruff checkclean.
A third tier between the cheap Linker (signature-pairwise via Comparator)
and the LLM Confirmer (final arbiter). Operates on raw per-actor corpora
or one actor + one questioned document, returns a calibrated score. This
is what fills the Spanish-linkage gap until minhash lands, and the
generalization beyond it.
New abstraction: Verifier protocol — sibling to Comparator, but
takes two actors (or actor + questioned doc) and produces a
VerificationResult(score, confidence, evidence). Registry pattern,
pluggable, audit-logged.
Service shape: new eyenet/verifier/ subscribes to
attribution.linkage.proposed, runs the verifier registry on the
candidate pair, emits attribution.linkage.suspected when the composite
score clears a threshold. The existing Linkage state machine
(PROPOSED → SUSPECTED → CONFIRMED/REJECTED) and the Graph service
already accept this — no contract changes.
Methods to ship (in this order — least-to-most heavyweight):
- General Impostors (GI). Koppel/Schler verification on an impostor pool. The Rutify corpus IS the impostor pool. Best fit for short Spanish chat where stylometry is structurally hard. ~200 LOC, no new deps. PAN-bake-off mature.
- Normalized Compression Distance (NCD).
zlib-based, raw-text, language-agnostic. Sidesteps the function-word domain limit entirely. ~50 LOC, stdlib only. - Operator-confirmation feedback loop. Every
LinkageConfirmedbecomes a positive labeled pair; everyLinkageRejectedbecomes a negative. Persisted totests/fixtures/calibration/feedback_pairs.toml(or an SQLite table — design TBD). Feeds the LR fusion table below. - Cosine on multilingual sentence-transformer embeddings. Probably
the strongest single signal, but heaviest dependency (~400MB model
download, optional GPU). Likely model:
paraphrase-multilingual-MiniLM-L12-v2. Operator-opt-in via config. - Likelihood-Ratio fusion. Unifying composite scorer. Combines per-Verifier scores via LR tables calibrated on the feedback-loop labeled pairs. Forensic-stylometry standard. Gated on (3) producing ≥50 labeled positive pairs.
Methods deferred / skipped:
- Burrows' Delta / Cosine Delta. Designed for novel-length texts. Diminishing returns over GI + simhash on short chat. Revisit only if a long-form corpus lands.
Calibration plumbing the artifact reuses:
eyenet/calibration/recipes_grid.pyAND-of-axes / OR-of-groups Picker generalizes to Verifier-score fusion: every Verifier becomes one axis in an LR group. M5's labels TOML schema + corpus-sha256 pinning carry over verbatim.- The committed feedback-pairs TOML (post-(3)) is the LR fusion's training input — produced as a side-effect of operator activity, not hand-labeled.
Open design questions (decide at M7 kickoff):
- Pull or push? Verifier service either subscribes to
LinkageProposed(push, runs on every proposal) or exposes a CLI for operator-on-demand verification (pull, runs only when asked). Pull is cheaper; push catches more. - Bodies-on-the-bus or dereference-at-Verifier? The Verifier needs
evidence bodies, which the
LinkageProposedenvelope doesn't carry today. Either expand the envelope (heavier bus traffic) or have the Verifier dereference viaMessageStore(more audit-log volume). M4 §4.3 leans toward the latter. - Embedding model deployment: bundle the model with EYENET releases vs. operator-brings-their-own. The 400MB bundle changes the small-operator-friendly story — flagged for operator decision.
The clearance/file-access stack (M9 Groups A–F) gates access by
SensitivityTier, but nothing assigns that tier. M10 closes the loop:
every byte of evidence that lands — message attachments and standalone
operator uploads — gets a tier automatically at reception, deterministically
and defensibly. This is the milestone that makes clearance levels mean
something. Full design in development/CLASSIFIER_PLAN.md.
Load-bearing principle — fail-closed. Anything we cannot read, cannot parse,
or cannot reason about confidently becomes CLASSIFIED + an operator-review
flag. Under-classification is the only unacceptable error; over-classification
is merely annoying and operator-correctable (monotone-up promote, never demote).
Tier decision is 100% deterministic and reproducible.
tier = MAX(regex_floor, presidio_floor, extraction_failure_floor). The LLM
never mutates the tier — it only ever raises a hand (operator-review flag).
A tier is therefore court-defensible: re-runnable to the same answer, no model
weights in the decision path. This is the classifier-authoritative,
operator-promote-only reclassification model (API_PLAN §4.9) applied at intake.
Extraction is the security boundary. Parsing hostile documents (Tesseract
OCR, python-docx, pymupdf) is the highest-RCE-risk surface in the system, so
all extraction runs behind ONE chokepoint — extract_sandboxed(blob) -> ExtractResult | FAILED_CLOSED — over nsjail (userns→nobody, no network
interface, RLIMIT_AS/CPU/FSIZE, cgroup mem cap, time_limit, seccomp
allowlist, read-only input bind). Contract: a malicious boot canary
self-test proves the sandbox actually contains a hostile payload on every
startup (we re-prove isolation, we don't trust a config file); a throwaway,
networkless, unprivileged identity per parse; a parent-owned kill switch with
bounded output; abnormal exit ⇒ fail-closed. nsjail absent/old/unable-to-contain
⇒ degraded fail-closed mode (everything → CLASSIFIED). Linux-only by
design — the deployment target for sensitive evidence.
Pipeline (in order; deterministic stages are binding, LLM is advisory):
- Extraction adapters — Tesseract (OCR), python-docx (DOCX), pymupdf (PDF),
each behind
extract_sandboxed. Extraction failure ⇒CLASSIFIEDfloor. - Regex ruleset engine — versioned data rules → tier floors. The strongest, most predictable signal; the spine of the decision.
- Microsoft Presidio — PII detection, locale-aware via the existing spaCy models (reuses the M6.5 locale path). Maps recognizer hits → tier floors.
- Aggregator —
MAX(...)of the deterministic floors + provenance + audit row; short-circuits (skips downstream) once a stage hitsCLASSIFIED. - LLM tripwire — local model, flag-only / non-binding,
prompt-injection-hardened, skipped entirely when the tier is already
CLASSIFIED. Raisesoperator_reviewon anything the deterministic stages might have under-read; cannot move the tier.
Surface + execution. New Document table + an upload surface for standalone
operator uploads (attachments already exist). ClassifierService(ServiceBase),
async, processes at reception; rows are provisional-CLASSIFIED until
settled (fail-closed during the in-flight window). Calibration grid with the
false-negative rate as the headline metric (an under-classified secret is
the failure that matters).
Build plan — 9 slices, worktree, slice-per-commit, --no-ff merge (sandbox
first; nothing parses until isolation is proven):
- Sandbox chokepoint + boot canary (degraded fail-closed) — the load-bearing slice; prove isolation BEFORE wiring any parser.
- Extraction adapters (Tesseract / python-docx / pymupdf).
- Regex ruleset engine (versioned rules → floors).
- Presidio wiring (locale-aware via spaCy).
- Aggregator + provenance + audit.
- LLM tripwire (flag-only).
Documenttable + upload surface.ClassifierService.- Calibration grid (false-negative headline).
New runtime deps (Linux-only): nsjail (pinned policy, shipped),
tesseract-ocr, python-docx, pymupdf, presidio-analyzer. The LLM runtime
reuses the operator's local model story (decision deferred to slice 6, mirrors
the M8 embedding-model bundle-vs-BYO question).
Graph backend final choice:Resolved (M4, 2026-05-22). SQLite-with-edges shipped viaeyenet/storage/graph.py+eyenet/models/graph.py—GraphStoreexposesupsert_node,upsert_edge,neighbors,edges_by_type,stats. TypedGraphNodeType(Actor,Persona) andGraphEdgeType(LinkedTo,BelongsToPersona) drive the relation set. Zero-ops, embedded, no external server. Revisit only if scale forces a move to Neo4j or ArangoDB — theGraphStoreinterface is the swap point.Profile-state representation:Resolved (M3, 2026-05-13). Snapshot-per-update with monotonicversionwon.ProfileTable(eyenet/models/profile.py:19-45) writes a new row per Engine update withversion += 1; a partial unique index (ix_profile_one_current_per_actor,sqlite_where=is_current=1) floatsis_current=Trueto the newest row and forbids duplicates. Full history is preserved as immutable per-version rows — audit-friendly without a separate event log.ProfileStore.history(actor_id)(eyenet/storage/profiles.py:50) isWHERE actor_id=? ORDER BY version asc. Best of both worlds: snapshot ergonomics, event-sourced retention.Cross-platform actor ID:Resolved. Per-platformactor_key(actor:<sha256(source_kind||platform_userid)>, MODELS §0) stays the stable join key. Cross-platform identity is not a derivedactor_key— it is a separatePersona/ActorClusterentity (MODELS §2.6) constructed from confirmedLinkagerows (MODELS §2.5).Persona.member_actor_idsis the denormalized forward view (cheap reads);PersonaMembership(MODELS §2.6a) is the indexed reverse view (actor_id → persona_idlookup). Both are rebuildable from the linkage graph. Engine, Linker, and Graph never collapse two per-platform actor_keys into one; they emit/confirm linkages and letPersonacarry the cluster.- Collector Supervisor: deferred — manual launch is fine until the fleet exceeds ~3 collectors. Revisit only if real deployments outgrow that.
- BEHAVE-SHELL fusion: if a Telegram actor is also observed in a PTY (BEHAVE-SHELL), can the engine fuse both substrates? Out of scope for v0; flagged for v1.
- No automated engagement with actors.
- No active deception / honeypot behavior.
- No automated reporting to platforms.
- No web UI (CLI + graph query API only).
No multi-tenant operator separation.Revised (2026-05-04): multi-user IS in scope as of MODELS.md §2.17 (SystemUser). v0 default is single-user, but the model and permission system are designed for N operators from the start. Multi-tenant isolation (separate data realms per tenant) remains a non-goal.