Add entity-aware fact resolution against Nexus (Vikunja #279)

facts gain a Subject/EntityID/ResolutionState triple and an async
enrichment worker that resolves free-text subjects to canonical Nexus
entity_ids, mirroring Praxis's enrichment-worker pattern. Ambiguous or
unreachable Nexus never guesses an entity_id — the fact stays pending
or terminal-ambiguous instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ghELqYhZNLub2TXGMazqA
This commit is contained in:
kami
2026-07-20 12:00:37 +04:00
parent c932cd8677
commit 03fa52dfd4
8 changed files with 485 additions and 0 deletions
+11
View File
@@ -84,6 +84,12 @@ type Config struct {
// falls back to the rule's static Base, matching pre-autotune behavior).
AutotuneInterval Duration `json:"autotune_interval,omitempty"`
// FactEnrichmentInterval — how often the fact-entity enrichment worker
// polls for facts with resolution_state='pending' and resolves their
// subject against Nexus. Default 30s. Only runs when Nexus is configured;
// no-ops (harmlessly) otherwise.
FactEnrichmentInterval Duration `json:"fact_enrichment_interval,omitempty"`
// Ntfy — the ntfy push sink config. nil ⇒ ntfy channel not wired.
// sev3 (ops soft) away + sev4 (ops hard) present + reminders away all
// route here; not wiring ntfy means those routes drop silently.
@@ -357,6 +363,8 @@ const (
DefaultRouterThreshold = 0.55
DefaultQueryMinScore = 0.55
DefaultToolTimeout = 30 * time.Second
DefaultFactEnrichmentInterval = 30 * time.Second
)
// Load reads the JSON config at path and applies defaults. A missing file is
@@ -394,6 +402,9 @@ func (c *Config) applyDefaults() {
if c.AutotuneInterval == 0 {
c.AutotuneInterval = Duration(DefaultAutotuneInterval)
}
if c.FactEnrichmentInterval == 0 {
c.FactEnrichmentInterval = Duration(DefaultFactEnrichmentInterval)
}
// StateDir — when set, use it as the base for both db and socket if their
// paths are still relative (empty). If StateDir is empty, fall back to the
// XDG-style defaults (data dir for db, runtime dir for socket).