Totem Shield
Version updated for https://github.com/mmnto-ai/totem to version @mmnto/cli@1.15.3.
- This action is used across all versions by 0 repositories.
Action Type
This is a Composite action.
Go to the GitHub Marketplace to find the latest changes.
Action Summary
Totem is a CLI tool that provides a persistent memory and enforcement layer for AI coding agents, addressing their tendency to forget architectural context and repeat mistakes. It automates the process of converting plain-English lessons about coding errors into enforceable rules, which are applied during code linting to maintain architectural integrity and prevent recurring issues. By operating offline and without requiring runtime LLMs, Totem ensures fast, deterministic rule enforcement and improves collaboration between AI agents and human developers.
What’s Changed
Patch Changes
b782d4e: 1.15.3 bundles three compile-worker quality fixes and the runtime ReDoS defense. All three extend the ADR-091 Classify stage or harden the deterministic-enforcement path under
totem lint.Bounded regex execution (closes #1641)
- Runtime per-rule-per-file timeout on regex evaluation via a persistent Node worker thread. Catastrophic-backtracking patterns now terminate at the configured budget instead of hanging
totem lint. Pre-exhibit defense against a ReDoS attack chain that survives every prior gate (safe-regexstatic check, bidirectional smoke gate, human promotion review). totem lint --timeout-mode <strict|lenient>— new flag on the lint command.strict(default) fails non-zero on any timeout;lenientskips the offending rule-file pair with a visible warning. Strict mode is the CI path.- New
packages/core/src/regex-safety/module (evaluator.ts,worker.ts,apply-rules-bounded.ts,telemetry.ts). AsyncapplyRulesToAdditionsBoundedsibling to the sync path, policy-free — returns{violations, timeoutOutcomes}and lets the CLI apply strict-vs-lenient exit-code policy. - Telemetry: every terminal outcome (match, no-match, timeout, syntax error) writes a
type: 'regex-execution'record to.totem/temp/telemetry.jsonl, Zod-validated againstRegexTelemetrySchemawith repo-relative path redaction (paths outside the repo root become<extern:<sha256-12>>). - Race-condition hardening baked in:
respawnPromisecoalesces concurrent respawn requests,MAX_CONSECUTIVE_RESPAWNSguards against infinite spawn loops on a permanently-broken worker, and a cold-start gate prevents the 100ms default from misfiring under CI load.
Context-required classifier (closes #1598)
- New
reasonCode: 'context-required'route on the compile-worker output schema. Lessons whose hazard is scope-bounded by a context the pattern cannot structurally capture (e.g.,"sim.tick() must not advance inside _process") now route to thenonCompilableledger instead of compiling into false-positive-prone rules. - Narrow LLM-emittable enum on
CompilerOutputBaseSchema.reasonCode(not the fullNonCompilableReasonCodeSchema), preventing the LLM from forging internal codes likeverify-retry-exhausted. Extends ADR-091’s Classify stage. - New Context Constraints Classifier section on the compile prompt with marker heuristics (inside / when / only-for-new / must-not) and an explicit anti-lazy rule-of-thumb: compilation MUST still succeed when
fileGlobs/ ast-grepkind:/inside:/has:/regex:combinators can express the guard.
Semantic-analysis classifier + ledger hygiene
Closes #1634 + #1627.
- Extends the narrow
reasonCodeenum with'semantic-analysis-required'covering four sub-classes: multi-file contracts, closure-body AST analysis, system-parameter-aware scoping, project-state-conditional semantics. Sub-class carried in the prosereason; one consolidated code keeps the LLM contract tight. - Pipeline 2 and Pipeline 3
!parsed.compilablebranches switch from per-code conditional checks toparsed.reasonCode ?? 'out-of-scope'. Future narrow classifiers thread through without per-code switches. LEDGER_RETRY_PENDING_CODESset +shouldWriteToLedger(reasonCode)predicate exported from@mmnto/totem. CLI ledger guard now rejects writes for retry-pending codes (pattern-syntax-invalid,pattern-zero-match,verify-retry-exhausted,missing-badexample,missing-goodexample,matches-good-example) so transient smoke-gate rejections no longer permanently mark lessons as unfit.- Symmetric stale-entry prune on both compiled branches (local + cloud) when a lesson compiles cleanly, and on cloud smoke-gate rejection. Cleaned three stale
matches-good-exampleentries from the shipped ledger.
- Runtime per-rule-per-file timeout on regex evaluation via a persistent Node worker thread. Catastrophic-backtracking patterns now terminate at the configured budget instead of hanging
Updated dependencies [b782d4e]
- @mmnto/totem@1.15.3