feat(commands): deterministic [commands] reflex — drive skills without the LLM - #7
Open
ceounittt wants to merge 2 commits into
Open
feat(commands): deterministic [commands] reflex — drive skills without the LLM#7ceounittt wants to merge 2 commits into
[commands] reflex — drive skills without the LLM#7ceounittt wants to merge 2 commits into
Conversation
added 2 commits
August 7, 2026 23:00
Add [commands] to albert.toml: a /name -> {skill_path, args, reply
template, owner_only, timeout} map, parsed into Config.commands. The
dispatcher (next commit) runs the script via forkd and renders its JSON
stdout through the template as a reflex, before the LLM.
…out the LLM
A config-declared `[commands]` table maps a `/name` to a skill script run via
forkd and renders its JSON stdout through a `{field}` template, answered as a
reflex before the LLM — the deterministic counterpart to the owner-only ACL
admin commands. Lets a user drive Albert's existing skills fast, cheap, and
predictably: no model call, no agent turn.
- src/commands.rs: the dispatcher — owner_only gate (reuses acl::is_owner),
{arg} substitution guarded by a usage hint, forkd.run round-trip, template
render (missing path → —, non-JSON echoed raw), reply capped to Telegram's
limit, timeout clamped to forkd's max. help_listing feeds /help.
- cogitator.rs: wire the reflex after the ACL check; /help now composes the
built-in help with the configured command listing (so [commands] are
discoverable and can't be shadowed by a "/help" entry).
- config.rs: load-time validation — command names must start with '/', warn on
collision with a built-in reflex.
- albert.toml / README / docs: a documented example + a reference section.
- 19 unit tests over build_args/fill/resolve/render/capped/help_listing.
ceounittt
force-pushed
the
feature/reflex-commands
branch
from
August 8, 2026 06:22
455c1fb to
44a8f80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
A user with no LLM turn can't drive Albert at all. This PR adds deterministic
/commands: a config-declared[commands]table binds a/nameto a skill script, runs it via forkd, and renders the JSON output through a template — as a reflex, before and instead of the LLM. It's the deterministic counterpart to the owner-only ACL commands (/allow/deny/allowed). Fast, cheap, predictable: no model call, no agent turn.Covers both code and config in a single PR.
How it works
/name arg→ forkdforkd.run {skill_path, interpreter, args, timeout_secs}→ renders{field}/{nested.field}from the script's JSON stdout.{arg}inargsreceives the text after the command word; calling it with no text returns a short usage hint (never a stray empty argv token).replytemplate: an unresolved path renders as—, non-JSON stdout is echoed as-is, and the reply is capped to Telegram's message limit./helpis auto-composed: the built-in help plus the listing of configured commands.Security
owner_onlyis enforced before any forkd dispatch (reusesacl::is_owner).{arg}is substituted only intoargs, never intoskill_path/interpreter(both config-only)./; a collision with a built-in reflex is warned about.Tests
19 unit tests over
build_args/fill/resolve/render/capped/help_listing(edge cases: empty{arg}, unbalanced braces, a value containing{...}is not re-expanded, timeout vs non-zero exit, oversized-reply truncation).cargo testandcargo build --releaseare green.Files
src/commands.rs— the dispatcher (new);src/config.rs—CommandSpec+ validation;src/cogitator.rs— reflex wiring +/help.albert.toml,README.md,docs/configuration.md,docs/structure.md— example + reference.