← Documentation index Architecture guide › fastpaths and autopaths

Metnos

fastpaths and autopaths — safe reuse of solved plans
Architecture guide

Table of contents

  1. The idea, in two lines
  2. Why a fast-path is necessary
  3. The two layers and their boundary
  4. L0 — runtime-produced cache (fastpath.py)
  5. L1 — reuse across a request family (autopath.py)
  6. Validity, aging, and usage transfer
  7. The arguments extractor
  8. Configuration
  9. Promotion to a synthesised executor

1. The idea, in two lines

Ask Metnos with a request like this example: “Find the PDF files modified today.” If you repeat the request, Metnos may reuse the plan that already succeeded; you do not select or enable the fastpath manually.

Before calling the planner, Metnos tries to recognise the request. If a reusable plan exists and is still valid, it runs that sequence of executors. If the context or catalogue has changed, it treats the entry as invalid and returns to normal planning.

request user query L0 fastpath exact or equivalent query L1 autopath cluster + champion plan engine LLM planner
Figure 1 — Metnos tries L0 and L1 in that order. If neither yields a valid plan, the request proceeds to the planning engine.

2. Why a fast-path is necessary

Planning is needed when a request is new or requires a new composition of capabilities. Repeating it when the system already holds a valid plan adds work and variability without improving the result. For example, a request already solved with get_urls and describe_entries can reuse that sequence, provided its arguments are derived from the current request.

What remains is to recognise a known request — and to judge when one that is merely similar sits close enough to be handled the same way. Two reuse layers handle this distinction. They recognise different degrees of similarity, but share one purpose: run a known plan without asking the planner to build it again.

3. The two layers and their boundary

The two layers differ in how much of the path they recognise. L0 recognises all of it, arguments included: the same request as before, with the same concrete values. L1 recognises the path alone — the skeleton of the solution, stripped of its arguments — and so it holds for a whole family of related requests.

LayerWhat it recognisesHow
L0An already solved request. Exact matching may retain a request-specific plan; semantic matching is limited to plans that are safe to generalise.Deterministic fingerprint (0a), then similarity through the configured embedder (0b)
L1A family of requests. Reuses a general plan associated with a complete intent and semantic cluster.Intent, semantic cluster, and deterministic champion ordering

The order is fixed: L0 first; if it finds nothing, L1. If both miss, the request reaches the planner (the engine), as always.

The planner does not disappear: L0 and L1 are controlled shortcuts. A new or ambiguous request, a turn with attachments, or a request without a valid match continues through the normal engine.

4. L0 — runtime-produced cache (fastpath.py)

The first layer lives in runtime/engine/fastpath.py and keeps the plans it has already run in a SQLite database (fastpaths.sqlite). The entries appear on their own: whenever a turn succeeds — a fresh plan from the engine, the reuse of an L1, a promotion from cosine 0b — Metnos notes down the canonical query, its hash, the embedding produced by the configured model, the whole plan (the skeleton, or framework) and the intent: the verb and the object of the request. No approval involved: the chains are built from executors already vetted and tested.

Two ways to find a match

The search runs in two phases:

An L0 entry removed because it aged, became invalid, or received negative feedback can be recreated by the next successful turn. Removing it does not remove the underlying capability.

Safety valves

5. L1 — reuse across a request family (autopath.py)

The second layer lives in runtime/engine/autopath.py. It does not look for the same wording. It finds a semantic family, checks that the intent object matches, and reuses only plans without literal arguments tied to the original request. Variable arguments are derived again from the current request before execution.

An autopath can arise in two ways. Positive feedback promotes a successful plan once it reaches the configured threshold, which is one confirmation by default. Alternatively, two successful runs of the same intent can seed a shadow autopath when the latest plan contains at least four steps. A shadow is usable but remains distinct from a confirmed plan; the first positive rating confirms it. This second path reduces the cost of recurring requests without presenting a non-human signal as human approval.

Feedback and plan selection

The boundary is deliberate: L0 favours repetition of the same request; L1 generalises to an intent group and may derive either from explicit feedback or from the shadow seeding described above. L0 comes first in the cascade, but both layers must pass the same validity, argument-grounding, and safety checks before execution.

6. Validity, aging, and usage transfer

Operational-world signature

Every stored plan carries two signatures: one for the executors it uses and one for the candidate family available for that intent. The signature also incorporates the version of routing and presentation rules. Metnos recomputes them before reuse: a changed or removed executor, a new competing capability, or a routing change turns the entry into a miss. The system replans instead of executing a decision made in a different operational context.

These signatures are user-agnostic and contain no profiles, affinities, or personal preferences. L1 therefore remains a shared cache of plan decisions with deterministic keys. Effects authorised for the user and final presentation — language, tone, length, and format — are applied outside the plan key.

The candidate family comes from the canonical vocabulary, including the relationships between specialised content and filesystem carriers. For example, a new files capability may change a plan operating on images or texts. Query words and manifest affinities do not enter the signature: invalidation follows catalogue semantics without making L1 specific to a user or to one phrasing.

L0 fastpaths are retained or retired by fixed rules, with no model in the loop. Each night the task_state_reaper process applies three aging rules and four retirement conditions.

Aging

RuleCriterionDefaultEnv
Never reusedCreated more than N days ago but never served a second time14 daysMETNOS_FASTPATH_GRACE_DAYS
StaleLast use more than N days ago30 daysMETNOS_FASTPATH_STALE_DAYS
LRU capTotal entries above the cap; least recently used are pruned500METNOS_FASTPATH_MAX

Retirement (only with a complete catalogue)

CodeCauseTransfers usage
C1A tool in the plan no longer exists in the catalogue (retired, renamed, archived). Replay would fail.No
C2 provenanceThe fastpath was promoted to a synthetic executor (see §9) and that executor is now in the catalogue.Yes
C2 nameAn executor named {verb}_{object} matching the intent exists, but no tool in the plan belongs to that family. The fastpath would shadow the executor.Yes
C2 pre-filterFor multi-step plans: the deterministic routing pre-filter on the canonical query shows that a single executor now covers the intent (even under a different name).Yes

Usage-count transfer

When a fastpath is retired because an executor superseded it (the C2 conditions), its usage count (n_uses) passes to that executor through the lifecycle statistics store. Previously observed usage is therefore not reset.

Pruning removes a stored route, not its executors. If the same request returns and succeeds, L0 can record the updated plan again.

7. The arguments extractor

Recognising the request is half the work. The other half is drawing out its concrete values: which paths, which URLs, which date, which threshold. A rule-based extractor (args_extractor.py) handles this, again with no model:

8. Configuration

Fastpath and autopath thresholds are read from the Metnos process environment; when a variable is absent, the module default applies. The former [fast_path] and [multi_tool_fast_path] sections in ~/.config/metnos/runtime.toml have been retired and are ignored. The Praxis page can inspect and flush the caches, but it does not edit these thresholds. A persistent override therefore belongs in the service configuration; constants read at import time require a process restart.

Layer 0 (fastpath)

VariableDefaultMeaning
METNOS_FASTPATH1Enables L0; setting it to 0 disables the layer
METNOS_CLUSTER_COSINE_HIGH0.90Base semantic threshold; L0 matching uses this value plus 0.02
METNOS_FASTPATH_STALE_DAYS30Calendar days after which an unused entry is pruned
METNOS_FASTPATH_GRACE_DAYS14Grace days for never-reused entries
METNOS_FASTPATH_MAX500Maximum rows (LRU cap)

Layer 1 (autopath)

VariableDefaultMeaning
METNOS_AUTOPATH1Enables L1; setting it to 0 disables the layer
METNOS_AUTOPATH_MIN_OBS1Minimum positive observations to promote an autopath
METNOS_AUTOPATH_FLOOR0.87Minimum similarity on the exact-intent fallback
METNOS_AUTOPATH_TTL_ANTI2592000 (30 d)Anti-autopath duration in seconds
METNOS_AUTOPATH_TTL_REPEAT3600 (1 h)Temporary exclusion after a repeat request
METNOS_AUTOPATH_KEEP_OBS5000Maximum recent observations without a verdict to retain
METNOS_AUTOPATH_STALE_DAYS90Inactivity period before an active autopath is removed
METNOS_AUTOPATH_DEMOTED_TTL_DAYS30Retention period for a demoted autopath
METNOS_SEED_STEPS4Minimum step count for shadow seeding
METNOS_SEED_REPEAT2Successful observations of the same intent required for shadow seeding

Promotion to executor

VariableDefaultMeaning
METNOS_FP_PROMOTE_MIN_CLUSTER3Minimum distinct fastpaths in the group
METNOS_FP_PROMOTE_MIN_USES15Minimum cumulative usage
METNOS_FP_PROMOTE_MIN_AGE_DAYS30Minimum group age
METNOS_FP_PROMOTE_MAX_PER_NIGHT3Maximum new proposals per night
METNOS_FASTPATH_AUTOPROMOTEoffEnables Mode 2 auto-promotion (no human approval)
METNOS_FP_AUTOPROMOTE_MIN_CLUSTER5Minimum distinct fastpaths for auto-promotion
METNOS_FP_AUTOPROMOTE_MIN_USES50Minimum cumulative uses for auto-promotion
METNOS_FP_AUTOPROMOTE_MIN_NIGHTS3Nights on which the same proposal must have been observed

9. Promotion to a synthesised executor

When several recurring L0 fastpaths share the same plan structure (the skeleton hash) and the same intent, each night the task_fastpath_promotion process weighs them as candidates to become a synthetic executor in their own right. What it weighs is the group, never the single instance: at least three distinct fastpaths, fifteen uses in all, and thirty days of age. And only multi-step shapes are promoted: single-step ones already have an executor, and there the fastpath only saves the LLM call, not the plan.

Why from L0 and not from L1. The analysis looks at the L0 fastpaths, not the L1 autopaths, because evidence of concrete requests lives in L0: how many distinct requests recur, how often, and for how long (the three numbers above). L1 is already general and arises from user feedback or shadow seeding, but it does not retain that count of distinct requests. Generalisation therefore happens here by grouping L0 fastpaths with the same plan shape and intent.

Two modes of promotion

Where an executor comes from

For candidates whose family is free, Metnos records the source fastpath identifiers and fingerprints in the promotions table. Once the new executor enters the catalogue, the nightly process uses that link to retire exactly the entries that produced it. Composition candidates do not receive this automatic provenance because their final name depends on the human-selected qualifier; their L0 entries remain manageable under Settings > Memory > Praxis.

© 2026 Roberto Brunialti · Metnos documentation