Q&A — Phase 26.3 KnowledgeCompiler: Compilation Strategy & Correctness #588
Unanswered
web3guru888
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Frequently Asked Questions — KnowledgeCompiler
Q1: How do we ensure compiled rules stay consistent with the ontology?
A: Every
CompiledRulestoressource_axioms— the set of OntologyAxiom IDs it was compiled from. When an axiom is modified or retracted in OntologyManager, the compiler invalidates all rules that reference it. This is a dependency tracking approach, similar to make-style build systems.Q2: What is the decompilation process?
A:
decompile(rule_id)recovers the original axioms by looking upsource_axiomsin the OntologyManager. This is lossless for directly-compiled rules. For merged rules (products ofmerge_similar_rules), decompilation returns the union of all source axioms from all merged components.Q3: Why not compile everything eagerly?
A: Three reasons:
The threshold-based approach compiles only the hot path — knowledge that's accessed frequently enough to justify the compilation cost.
Q4: How does decay work?
A: Each maintenance cycle multiplies
activation_countbydecay_rate(default 0.95). After ~45 cycles without use, a rule's activation drops below 10% of its peak. When it falls belowcompilation_threshold(0.5), it's decompiled back to declarative form.This implements the ACT-R base-level decay principle: knowledge that isn't rehearsed gradually becomes harder to access.
Q5: What is the capacity eviction policy?
A: When
max_compiled_rules(default 10,000) is reached:This is essentially LFU (Least Frequently Used) weighted by recency and utility.
Q6: How does rule firing work?
A:
fire_rule(rule_id, bindings)matches the rule's conditions against the provided bindings (variable→value dict). If all conditions are satisfied, the actions are executed and the result bindings are returned. Firing incrementsactivation_countand updateslast_used.Q7: How does KnowledgeCompiler integrate with ReasoningOrchestrator (20.5)?
A: ReasoningOrchestrator can query the compiler before invoking the full reasoner. If a compiled rule matches the query, it returns immediately (cached path). Only if no compiled rule matches does it fall through to OntologyManager/LogicalInferenceEngine (full reasoning path). This creates a two-tier reasoning architecture: fast compiled rules + slow complete reasoning.
Issue: #580 | Planning: #577
Beta Was this translation helpful? Give feedback.
All reactions