Skip to content

feat(admin): runtime settings, versioned rules and knowledge, per-scope spend - #25

Merged
songecko merged 4 commits into
masterfrom
feature/admin
Oct 21, 2026
Merged

songecko merged 4 commits into
masterfrom
feature/admin

Conversation

@songecko

Copy link
Copy Markdown
Contributor

What

The core pieces a host needs to configure and teach the agent from an admin, without a deploy.

  • Runtime settings: Config\ConfigOverridesInterface lays the host's saved settings over the
    configuration per request (RuntimeAgentConfig). A rejected value falls back to the
    configuration and is logged.
  • Platform and key per request: RoutedProvider picks the turn's and the memory's platform
    on each call; ApiKeyResolverInterface gives a key per platform, used through KeyedPlatform
    (KeyedPlatformPass rebuilds the configured platform with it).
  • Spend per scope: each call is recorded under a scope (SpendEntry::$scope), and
    scopeDailyBudgetUsd caps it per day. The configured day cap still applies to the total.
  • Versions: Content\VersionStoreInterface (in memory and Doctrine, optional
    orm.classes.content_version) with drafts, publications and "back to the default". The
    versioned sources override the configured rules and documents by id; RuleBook, GuideIndex
    and the cached prompt rebuild when the revision changes.
  • Cached prompt: StaticPromptBuilder keeps one text per combination of settings, fragments,
    rules and guides, so it stays byte-identical across turns until one of them changes.
  • Memory retention: MemoryRetentionInterface lets the host decide the retention
    agent:prune uses.
  • Session\CurrentSession for settings read outside a request (a memory worker).

Breaking

  • SpendLedgerInterface: new scopeSpend() and a $scope argument on record().
  • SpendEntry gains the scope column and its index: the host needs a migration.
  • The configured rules and Markdown files are no longer tagged themselves; the versioned
    sources wrap them.

…pe spend

- Config: ConfigOverridesInterface over AgentConfig through RuntimeAgentConfig;
  AgentLoop, BudgetPolicy, MemoryRuntime and StaticPromptBuilder read the provider.
- Providers: RoutedProvider picks the turn's and memory's platform per call;
  ApiKeyResolverInterface with KeyedPlatform and KeyedPlatformPass for a key per platform.
- Budget: SpendEntry::$scope and scopeDailyBudgetUsd, a day cap per scope.
- Content: VersionStoreInterface (memory and Doctrine) with drafts, publications and
  back to the default; VersionedRuleSource and VersionedKnowledgeSource override by id.
- StaticPromptBuilder keeps its text per settings, fragments, rules and guides.
- CurrentSession for settings outside a request; MemoryRetentionInterface for agent:prune.
- ScopedCapabilityInterface and ScopeArea: a capability names an area of what
  the assistant does; the "Stay within …" line lists the registered ones by
  priority, as the reference builds it ("a and b", "a, b, and c").
- Without any area the line keeps the neutral default (DEFAULT_SCOPE).
- identity.scope and AgentConfig::$scope are removed (breaking).
- ScopedCapabilityInterface and ScopeArea: a capability names an area of what
  the assistant does; the "Stay within …" line lists the registered ones by
  priority ("a and b", "a, b, and c").
- Without any area the line keeps the neutral default (DEFAULT_SCOPE).
- identity.scope and AgentConfig::$scope are removed (breaking).
@songecko
songecko merged commit 4907ae0 into master Oct 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant