Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
e9baaee
chore(scripts): exclude .slim/.sffmc from audit-public-content find f…
Jun 29, 2026
e865772
fix(workflow): persist run args, settle token-cap, bound outcome cache
Jun 29, 2026
3d27d6a
fix(shared): loadConfig validate callback + validateSafeRegex helper
Jun 29, 2026
820ae9d
fix(rules): pre-compile command_match patterns with ReDoS guard
Jun 29, 2026
cee3352
fix(log-whitelist): validate user regex via safe-regex before compile
Jun 29, 2026
29a300d
fix(auto-max): delete + recreate session state on SESSION_CREATED
Jun 29, 2026
868b235
fix(memory): UNIQUE constraint + AGENTS.md injection redaction
Jun 29, 2026
db760dc
fix(max-mode): redact injection in winner content
Jun 29, 2026
7e42551
refactor(workflow|memory|max-mode|rules|log-whitelist): readability pass
Jun 29, 2026
8d52c44
refactor(rules|shared): rename non-informative locals per naming review
Jun 29, 2026
86c732c
refactor(rules|memory|auto-max|shared): cosmetic naming polish
Jun 29, 2026
9247a86
refactor(max-mode|auto-max): final naming review cleanup
Jun 29, 2026
9b44b20
refactor(shared): dedupe getRules() user-rule compilation
Jun 29, 2026
17fc2b7
refactor(memory|auto-max): drop duplicated lookup + misleading unders…
Jun 29, 2026
9f28fbd
refactor(workflow): drop optional chaining in RuntimeOpts constructor
Jun 29, 2026
19b3c92
chore: add clonedeps infra for quickjs-emscripten dependency source
Jun 29, 2026
a6849f1
docs: v0.15.0 audit-finish + package consolidation design spec
Jun 29, 2026
419a0fe
docs: v0.15.0 design spec — adopt 5-package Variant 5a layout
Jun 29, 2026
a3bf43e
docs: v0.15.0 implementation plan with 37 bite-sized TDD tasks
Jun 29, 2026
65e03fa
docs: council verification fixes for v0.15.0 plan + spec
Jun 29, 2026
7b13b3f
docs(plan): apply 4 of 6 council-recommended open-item fixes
Jun 29, 2026
e3a42e0
docs: remove user-local /data/projects paths from v0.15.0 planning docs
Jun 29, 2026
bc0a658
docs: replace /data/projects/SFFMC paths with portable $REPO_ROOT
Jun 29, 2026
8200e6c
test(workflow): characterize WorkflowRuntime external API before refa…
Jun 29, 2026
2106495
test(workflow): tighten WorkflowRuntime characterization per reviewer…
Jun 29, 2026
0dd41cc
refactor(workflow): extract CounterManager from WorkflowRuntime (M-1)
Jun 29, 2026
d95a29b
refactor(extra): extract crc, paths, constants, types from checkpoint…
Jun 29, 2026
4ee8e18
refactor(workflow): extract OutcomeStore from WorkflowRuntime
Jun 29, 2026
130345a
refactor(extra): extract header build/read/write from checkpoint.ts (…
Jun 29, 2026
803ce83
refactor(workflow): extract WorkflowActivation from WorkflowRuntime (…
Jun 29, 2026
9b56f66
refactor(extra): extract reader, lines, migrations from checkpoint.ts…
Jun 29, 2026
1cd405d
refactor(workflow): extract WorkflowEventEmitter from WorkflowRuntime…
Jun 29, 2026
ea74d7b
refactor(extra): extract buffer (flush + LRU) from checkpoint.ts (M-1)
Jun 29, 2026
a94574d
refactor(extra): extract restore and hooks from checkpoint.ts (M-1)
Jun 29, 2026
a3bd8d1
refactor(extra): convert checkpoint.ts to thin re-export shim (M-1)
Jun 30, 2026
8cc3e8a
Merge branch 'refactor/m1.7-checkpoint' into main — extract 14 concer…
Jun 30, 2026
1f39644
Merge branch 'refactor/m1.3-emitter' into main — extract WorkflowEven…
Jun 30, 2026
f267ad5
Merge branch 'refactor/m1.5-scheduler' into main — extract WorkflowAc…
Jun 30, 2026
a0110e1
Merge branch 'refactor/m1.4-store' into main — extract OutcomeStore f…
Jun 30, 2026
85ab6fc
refactor(workflow): extract concurrency primitives to concurrency.ts …
Jun 30, 2026
07b6818
refactor(workflow): extract InternalRunEntry + makeEntry + outcomeFor…
Jun 30, 2026
2b78186
refactor(workflow): extract resolveScript to script-resolver.ts (M-1)
Jun 30, 2026
a408278
refactor(workflow): extract FlushManager to flush-manager.ts (M-1)
Jun 30, 2026
45f4ab9
test(workflow): remove resolved v0.14.3 debounce-wiring policy guard
Jun 30, 2026
9bfec94
refactor(workflow): extract 6 runSandboxed sub-helpers (M-3)
Jun 30, 2026
4cafab9
refactor(extra): extract 4 createJudgeTool sub-helpers (M-3)
Jun 30, 2026
7deb677
refactor(extra): extract 8 runDream pipeline sub-helpers (M-3)
Jun 30, 2026
5208357
refactor(extra): extract 5 createDreamTool sub-helpers (M-3)
Jun 30, 2026
fccd9b2
refactor: extract parseJudgeResponse + injectHooks sub-helpers (M-3)
Jun 30, 2026
ae6ada2
refactor(extra): extract buildArchiveRecord + drop unused _name param
Jun 30, 2026
072ec08
refactor(extra): extract load/dedup/cluster pipeline sub-helpers
Jun 30, 2026
2258ef7
refactor(extra): extract LLM prompt + cluster-processing sub-helpers
Jun 30, 2026
fa2f57b
refactor(extra): extract process/hook/cron factory sub-helpers
Jun 30, 2026
6d91d42
refactor(extra): extract judge prompt + call + marker sub-helpers
Jun 30, 2026
371fe89
refactor(extra): extract judge validation + fallback + verdict helpers
Jun 30, 2026
6df0756
refactor(workflow): extract sandbox runtime + async sub-helpers
Jun 30, 2026
54422ef
feat(shared): add FsOps interface + defaultFsOps + mockFsOps; refacto…
Jun 30, 2026
5ad1e9a
refactor(workflow): inject defaultFsOps into WorkflowPersistence sync…
Jun 30, 2026
ead023c
feat(shared): add clock primitive (__setClock/__resetClock); persiste…
Jun 30, 2026
f4f9bbc
feat(shared): add isSafeRunID + safeRunID + RUN_ID_REGEX; persistence…
Jun 30, 2026
c0eff41
test(extra): demonstrate testability via mockFsOps + __setClock
Jun 30, 2026
da53d44
refactor(workflow): rename o → agentOpts in spawnAgent + executeAgent…
Jun 30, 2026
1b3e74a
refactor(extra): rename sanitizeResult → sanitizeValue in checkpoint/…
Jun 30, 2026
0261928
refactor(max-mode|extra): rename n → candidateCount in judge (M-5)
Jun 30, 2026
4ca7950
refactor(eos-stripper): rename result → scratch in stripEos (M-5)
Jun 30, 2026
be874b1
fix(extra): clamp runDream cap to MAX_OVERFLOW for defense-in-depth i…
Jun 30, 2026
63df65b
fix(extra): clear prior factory's cron timer in createDreamTool (mult…
Jun 30, 2026
80da265
chore(lockfile): regenerate bun.lock to fix workspace version drift (…
Jun 30, 2026
3f33883
refactor(workflow): promote fsyncPendingPaths + fsyncTimer to Workflo…
Jun 30, 2026
c7f3746
refactor(workflow): promote lockMap to Concurrency class instance fie…
Jun 30, 2026
a6c7d06
test(workflow): add WorkflowPersistence isolation test for fsyncPendi…
Jun 30, 2026
fe98b4e
refactor(packages): create 3 new standalone packages + clear composit…
Jun 30, 2026
895010e
refactor(packages): move workflow src into @sffmc/runtime (P-1 step 2)
Jun 30, 2026
94c3e1c
refactor(packages): move max-mode + compose + health into @sffmc/cogn…
Jun 30, 2026
b2eea98
refactor(packages): move 5 governance standalones + shared into safet…
Jun 30, 2026
46d7896
refactor(packages): move extra src into @sffmc/memory (P-1 step 5)
Jun 30, 2026
5cd3f9f
fix(memory): rewrite extra internal @sffmc/shared → @sffmc/utilities
Jun 30, 2026
cff391e
refactor(packages): delete @sffmc/agentic composite (P-1 step 7)
Jun 30, 2026
c120c23
fix(tooling): update audit-load-order.py + run-health.ts + check-redo…
Jun 30, 2026
c955f46
fix(memory): update test fixture relative paths to new src/extra/ loc…
Jun 30, 2026
b8cd718
chore(release): v0.15.0 version bump + CHANGELOG entry
Jun 30, 2026
467a19a
fix(release): pre-push release-blocker fixes (v0.15.0 P-01..P-14)
Jun 30, 2026
a005a2a
fix(memory): update extra.test.ts to test @sffmc/memory (the plugin) …
Jun 30, 2026
972e045
docs(readme): v0.15.0 package table updates
Jun 30, 2026
a69ae7f
docs(v0.15.0): update user-facing docs for 5-package layout
Jun 30, 2026
8247a31
fix(test): correct relative import path in watchdog/d2-config.test.ts
Jun 30, 2026
2d69623
docs(audit): v0.15.0 pre-release security audit report
Jun 30, 2026
919afba
chore(repo): remove internal process artifacts from public repo
Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ dependencies/
.codegraph/
# Ignore .slim/* runtime files
.slim/*
# BEGIN oh-my-opencode-slim clonedeps
# (cloned source repos — gitignored)
.slim/clonedeps/repos/
# (the structured manifest is reviewable project metadata and IS tracked)
!.slim/clonedeps.json
# END oh-my-opencode-slim clonedeps

# Internal process artifacts (move to ~/.superpowers/sdd/<project>/)
/docs/superpowers/
/pr-review-*
/*-security-audit.md
/security-audit-*.md
/audit-report-*.md
9 changes: 9 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BEGIN oh-my-opencode-slim clonedeps
!.slim/
!.slim/clonedeps.json
!.slim/clonedeps/
!.slim/clonedeps/repos/
!.slim/clonedeps/repos/**
.slim/clonedeps/repos/**/.git/
.slim/clonedeps/repos/**/.git/**
# END oh-my-opencode-slim clonedeps
14 changes: 14 additions & 0 deletions .slim/clonedeps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "1.0.0",
"updatedAt": "2026-06-30T00:00:00.000Z",
"dependencies": [
{
"name": "quickjs-emscripten",
"resolvedVersion": "0.32.0",
"repoUrl": "https://github.com/justjake/quickjs-emscripten.git",
"ref": "df4efb9ef2cb25c417ecb57986da462d11b244ed",
"path": ".slim/clonedeps/repos/justjake__quickjs-emscripten",
"reason": "QuickJS sandbox engine source for packages/workflow/src/sandbox.ts. Useful for debugging handle leaks, deadline-interrupt semantics, and marshal-in/marshal-out edge cases. Not needed for ordinary workflow development."
}
]
}
19 changes: 13 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# SFFMC — Agent Instructions

A Bun-workspace monorepo of 14 SFFMC packages (3 composite + 10 sub-features + 1 SDK) porting killer features from Xiaomi's [MiMo-Code](https://github.com/XiaomiMiMo/MiMo-Code). MIT licensed. v0.9.0 shipped.
A Bun-workspace monorepo of 5 SFFMC packages (2 composite + 3 standalones; utilities is a library, not a plugin) porting killer features from Xiaomi's [MiMo-Code](https://github.com/XiaomiMiMo/MiMo-Code). MIT licensed. v0.15.0 shipped.

## Repository Map

Expand All @@ -13,7 +13,7 @@ Before working on any task, read `codemap.md` to understand:
- Directory responsibilities and design patterns
- Data flow and integration points between modules

For deep work on a specific folder, also read that folder's `codemap.md` (e.g. `packages/workflow/codemap.md` for the workflow engine).
For deep work on a specific folder, also read that folder's `codemap.md` (e.g. `packages/runtime/codemap.md` for the workflow engine).

## Architecture: composite

Expand All @@ -23,7 +23,7 @@ Every SFFMC plugin follows the **composite** pattern:
- **No shared state** between plugins — no module-level state shared via re-export
- **Hot-pluggable** — adding/removing a plugin does not affect the others

This means `rm -rf packages/foo && bun test` should still pass for the remaining 12.
This means `rm -rf packages/foo && bun test` should still pass for the remaining 4.

## Common Tasks

Expand All @@ -34,7 +34,7 @@ bun test
# Type-check (uses bun build --no-bundle, no global tsc needed)
bun run typecheck

# Run health diagnostic (13 checks, JSON output)
# Run health diagnostic (9 checks, JSON output)
bun run scripts/run-health.ts

# Audit hook conflicts (0 conflicts expected)
Expand All @@ -43,8 +43,8 @@ python3 scripts/audit-load-order.py
# Build all plugins to /tmp/sffmc-build
bun run build

# Pre-commit runs 4 gates automatically
git commit -m "..." # runs bun test + typecheck + audit + sffmc_health
# Pre-commit runs 8 gates automatically
git commit -m "..." # runs typecheck + test + audit-load-order + audit-public + audit-redos + cleanroom + health + bun-install-frozen
```

## Containerised Testing (Security Policy)
Expand Down Expand Up @@ -97,3 +97,10 @@ If you have two OpenCode instances (development + production), you can restart t
- [RELEASE.md](RELEASE.md) — publication prep checklist (5 decisions)
- [CHANGELOG.md](CHANGELOG.md) — per-version release notes
- [docs/load-order-audit.md](docs/load-order-audit.md) — hook conflict analysis

## Cloned Dependency Source

Read-only dependency source repositories are available under
`.slim/clonedeps/repos/` for inspection. Do not edit these clones.

- `.slim/clonedeps/repos/justjake__quickjs-emscripten/` — `justjake/quickjs-emscripten` at `df4efb9ef2cb25c417ecb57986da462d11b244ed` (v0.32.0); the QuickJS sandbox engine used by `packages/workflow/src/sandbox.ts`. Reach for this source when debugging handle leaks, deadline-interrupt semantics, or marshal-in/marshal-out edge cases in the workflow sandbox. Not needed for ordinary workflow development.
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# SFFMC Changelog

## v0.15.0 (2026-06-30)

### Changed (consolidated 13 → 5 packages)

- **Package consolidation** — 14 workspace members (13 packages + `shared/`) consolidated into 5 packages:
- `@sffmc/runtime` (was `@sffmc/workflow`)
- `@sffmc/cognition` (was `@sffmc/max-mode` + `@sffmc/compose` + `@sffmc/health`; replaces dissolved `@sffmc/agentic`)
- `@sffmc/guard` — package metadata layer (the 5 governance standalones are now internal sub-folders of `@sffmc/safety`)
- `@sffmc/persist` — package metadata layer (now an internal sub-folder of `@sffmc/memory`)
- `@sffmc/utilities` (was `shared/`)
- `@sffmc/safety` and `@sffmc/memory` retained as composites; their `composes[]` is now empty (members are internal sub-folders)
- **`@sffmc/agentic` composite dissolved** — users must now register `@sffmc/runtime` and `@sffmc/cognition` explicitly in `opencode.json` `plugins[]`
- **Imports updated across the codebase** — `@sffmc/{workflow,max-mode,compose,health,rules,watchdog,auto-max,eos-stripper,log-whitelist,extra,agentic,shared}` → `@sffmc/{runtime,cognition,safety,memory,utilities}` as appropriate

### Added (test/exports)

- `@sffmc/shared` → `@sffmc/utilities`: `FsOps` interface + `defaultFsOps` + `createMockFsOps()`
- `@sffmc/shared` → `@sffmc/utilities`: `unixNow()` + `__setClock()` + `__resetClock()`
- `@sffmc/shared` → `@sffmc/utilities`: `isSafeRunID()` + `safeRunID()` + `RUN_ID_REGEX`

### Fixed (Medium + Low audit findings — Phase 1 + Phase 2 work)

- **God-object extract**: `WorkflowRuntime` split into `CounterManager`, `WorkflowEventEmitter`, `OutcomeStore`, `WorkflowActivation`, `FlushManager` (per-entry / per-runtime / single-concern)
- **God-object extract**: `packages/extra/src/checkpoint.ts` (1296 LOC) split into 13 focused modules under `packages/extra/src/checkpoint/`
- **Long function split**: `runDream` (259→117 LOC), `runSandboxed` (175→99 LOC), `createJudgeTool` (158→123 LOC), `createDreamTool` (157→57 LOC), plus 19 other orchestrators reduced via private-helper extraction
- **Testability primitives** wired into 4 packages: `mockFsOps` mocking, `__setClock` time-travel, `safeRunID` export, `WorkflowPersistence` FsOps injection
- **Naming**: 4 high-impact renames (`o` → `agentOpts` × 2; `sanitizeResult` → `sanitizeValue`; `n` → `candidateCount`; `result` → `scratch`)
- **Hot-path tweaks**: `MAX_OVERFLOW` defense-in-depth clamp in `loadAndCacheMemories`; multi-factory cron timer cleanup in `createDreamTool`
- **Module-level state** promoted to instance fields: `fsyncPendingPaths` + `fsyncTimer` → `WorkflowPersistence` instance; `lockMap` → new `Concurrency` class
- **Ops**: regenerated `bun.lock` (workspace versions 0.14.3 → 0.15.0); removed dangling `better-sqlite3` symlink

### Migration

| Old npm | New npm | Migration |
|---|---|---|
| `@sffmc/workflow` | `@sffmc/runtime` | rename |
| `@sffmc/max-mode` | `@sffmc/cognition` | rename |
| `@sffmc/compose` | `@sffmc/cognition` | rename (composite subsumes) |
| `@sffmc/health` | `@sffmc/cognition` | rename (composite subsumes) |
| `@sffmc/rules` | `@sffmc/safety` | rename (composite subsumes) |
| `@sffmc/watchdog` | `@sffmc/safety` | rename (composite subsumes) |
| `@sffmc/auto-max` | `@sffmc/safety` | rename (composite subsumes) |
| `@sffmc/eos-stripper` | `@sffmc/safety` | rename (composite subsumes) |
| `@sffmc/log-whitelist` | `@sffmc/safety` | rename (composite subsumes) |
| `@sffmc/extra` | `@sffmc/memory` | rename (composite subsumes) |
| `@sffmc/agentic` | (removed) | replace with **two** entries: `"@sffmc/runtime": {}` and `"@sffmc/cognition": {}` in `opencode.json` `plugins[]` |
| `@sffmc/safety` | `@sffmc/safety` | unchanged |
| `@sffmc/memory` | `@sffmc/memory` | unchanged |
| `@sffmc/shared` | `@sffmc/utilities` | rename (library; not a plugin) |

> **Note on `@sffmc/utilities`:** not a plugin entry point. Consumers using the SDK as a library must update their imports; do not add `"@sffmc/utilities": {}` to `opencode.json` `plugins[]`.

---

## v0.14.9 (2026-06-28)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mkdir src
// SPDX-License-Identifier: MIT
// @sffmc/my-feature — see ../../LICENSE

import type { PluginContext } from "@sffmc/shared" // or your own interface
import type { PluginContext } from "@sffmc/utilities" // or your own interface

export default {
id: "@sffmc/my-feature",
Expand Down
53 changes: 24 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# SFFMC

**OpenCode plugin suite — 3 composite packages, 10 sub-features, MIT licensed.**
**OpenCode plugin suite — 2 composites + 3 standalones, MIT licensed. v0.15.0.**

[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Version 0.14.8](https://img.shields.io/badge/version-0.14.8-success)](https://github.com/Rahspide/sffmc/releases)
Expand All @@ -25,16 +25,16 @@ with judge selection, a sandboxed JavaScript workflow engine, and 18 markdown
compose skills.

The repo ships as 14 npm packages under the `@sffmc/*` scope. Three of them are
**composite packages** — `@sffmc/safety`, `@sffmc/memory`, and `@sffmc/agentic` —
**composites** — `@sffmc/safety` (5 governance features) and `@sffmc/memory` (FTS5 recall + checkpoint/judge/dream opt-ins). Three standalone packages: `@sffmc/runtime` (sandboxed JS workflow orchestrator), `@sffmc/cognition` (parallel reasoning + compose skills + health diagnostics), and `@sffmc/utilities` (shared SDK library; **not a plugin entry**, only consumed by other packages as `workspace:*` dep).
each of which is a thin wrapper that composes several sub-features into one
default export using `mergeHooks()` from `@sffmc/shared`. The remaining 10
`mergeHooks()` from `@sffmc/utilities`. The three standalones
packages are the individual sub-features; they still work standalone for
backward compatibility.

Every plugin is a **composite**: it reads any hook payload
freely but writes only to its own slot. No module-level exports, no shared
mutable state, no cross-plugin coupling. Load any combination — all three
composite packages, individual sub-features, or a mix — and they compose cleanly.
composites + standalones — they compose cleanly. The previously-dissolved `@sffmc/agentic` composite has been split into `@sffmc/runtime` + `@sffmc/cognition`; users must register both explicitly.

## Why use it?

Expand Down Expand Up @@ -72,8 +72,8 @@ cd ~/.sffmc/plugins/sffmc

| Command | Effect |
|---|---|
| `sffmc init` | Auto-detect config + add 3 composite plugins (safety, memory, agentic) |
| `sffmc init --all` | Add all 13 packages |
| `sffmc init` | Auto-detect config + add 2 composite plugins + 2 standalones (safety, memory, runtime, cognition) |
| `sffmc init --all` | Add all 5 packages |
| `sffmc init --only workflow,compose` | Pick specific packages |
| `sffmc update` | `git pull --ff-only` + re-sync config |
| `sffmc doctor` | Run 13-check diagnostic |
Expand All @@ -83,7 +83,7 @@ See [`docs/install.md`](./docs/install.md) for the full guide (pinned versions,

## What's new in v0.14.8

- **Documentation split into English + Russian.** `README.md` is now English-only; a language picker banner at the top links to `README.ru.md`. `CHANGELOG.md` is now English-only; Russian translations live in `CHANGELOG.ru.md`. Both new files contain the same content as the original bilingual inline format, just split for cleaner per-language navigation. No code changes — same 14 packages, same behaviour.
- **Documentation split into English + Russian.** `README.md` is now English-only; a language picker banner at the top links to `README.ru.md`. `CHANGELOG.md` is now English-only; Russian translations live in `CHANGELOG.ru.md`. Both new files contain the same content as the original bilingual inline format, just split for cleaner per-language navigation. **v0.15.0 BREAKING**: code consolidation; 13 packages → 5. See CHANGELOG.md migration table for `@sffmc/<old>` → `@sffmc/<new>` mapping.

<details>
<summary>Want individual sub-features instead? (after `sffmc init --all`)</summary>
Expand Down Expand Up @@ -122,7 +122,7 @@ All 10 sub-feature packages still work standalone for backward compatibility:
## Architecture

Each composite package is a thin wrapper that imports its sub-features and
passes them to `mergeHooks()` from `@sffmc/shared`. The merger categorizes
passes them to `mergeHooks()` from `@sffmc/utilities`. The merger categorizes
hooks into TRANSFORM, GATE, SIDE_EFFECT, and tool — so output-mutation hooks
chain, permission gates aggregate, and side-effects run independently with no
collision. The result is a single default export that behaves exactly like
Expand All @@ -133,7 +133,7 @@ opencode.json (3 file:// entries)
|
+----+----+
| |
[safety] [memory] [agentic] <- composite packages (thin wrappers)
[safety] [memory] <- composite packages (thin wrappers)
| | |
| +----+----+ |
| | | | |
Expand All @@ -148,15 +148,15 @@ opencode.json (3 file:// entries)
|mem- | |extra| |max- | |work-|
|core | | | |mode | |flow |
+-----+ +-----+ +-----+ +-----+
memory sub-features (2) agentic sub-features (4)
memory sub-features (3) runtime + cognition standalones

+--+--+ +--+--+
|comp-| |heal-|
|ose | |th |
+-----+ +-----+

+---------------------------------------------------+
| @sffmc/shared (SDK) |
| @sffmc/utilities (SDK) |
| loadConfig | PluginContext | mergeHooks | EventBus |
+---------------------------------------------------+
```
Expand All @@ -172,27 +172,22 @@ bus, and the `mergeHooks` composer.
|---|---|---|---|
| [`@sffmc/safety`](./packages/safety/README.md) | safety | Tool-failure recovery + destructive-op gates + log hygiene | stable |
| [`@sffmc/memory`](./packages/memory/README.md) | memory | Cross-session FTS5 recall + opt-in checkpoint/judge/dream | stable |
| [`@sffmc/agentic`](./packages/agentic/README.md) | agentic | Parallel reasoning + sandboxed workflow + compose skills + health | stable |
| [`@sffmc/watchdog`](./packages/watchdog/README.md) | safety | 3-failure rolling counter + auto-recovery | stable |
| [`@sffmc/rules`](./packages/rules/README.md) | safety | YAML gate-based allow/deny for destructive commands | stable |
| [`@sffmc/auto-max`](./packages/auto-max/README.md) | safety | Watchdog-driven auto-escalation to max-mode | stable |
| [`@sffmc/eos-stripper`](./packages/eos-stripper/README.md) | safety | Strip EOS tokens from local model outputs | stable |
| [`@sffmc/log-whitelist`](./packages/log-whitelist/README.md) | safety | Prevent permission-log spam on long daemon runs | stable |
| [`@sffmc/extra`](./packages/extra/README.md) | memory | Opt-in bundle: checkpoint, judge, dream | stable |
| [`@sffmc/max-mode`](./packages/max-mode/README.md) | agentic | Parallel drafts + judge selection | stable |
| [`@sffmc/workflow`](./packages/workflow/README.md) | agentic | Sandboxed JS orchestrator (quickjs-emscripten WASM) | stable |
| [`@sffmc/compose`](./packages/compose/README.md) | agentic | 18 markdown skills for common workflows (planning, TDD, verification, task delegation, etc.) | stable |
| [`@sffmc/health`](./packages/health/README.md) | agentic | Plugin diagnostic with JSON output | stable |
| [`@sffmc/shared`](./shared/README.md) | — | SDK: loadConfig, PluginContext, EventBus, mergeHooks | stable |
| [`@sffmc/safety`](./packages/safety/README.md) | composite | 5 governance features (rules, watchdog, auto-max, eos-stripper, log-whitelist) | stable |
| [`@sffmc/memory`](./packages/memory/README.md) | composite | FTS5 SQLite recall + checkpoint/judge/dream opt-ins | stable |
| [`@sffmc/runtime`](./packages/runtime/README.md) | standalone | Sandboxed JS workflow orchestrator (quickjs-emscripten WASM) | stable |
| [`@sffmc/cognition`](./packages/cognition/README.md) | standalone | Parallel reasoning (max-mode) + compose skills + health diagnostics | stable |
| [`@sffmc/utilities`](./packages/utilities/README.md) | library | Shared SDK (NOT a plugin; consumed as `workspace:*` dep) | stable |
| [`@sffmc/cognition`](./packages/cognition/README.md) | standalone | max-mode + compose (18 markdown skills for common workflows) + health (plugin diagnostics) | stable |
| [`@sffmc/utilities`](./packages/utilities/README.md) | — | SDK: loadConfig, PluginContext, EventBus, mergeHooks | stable |

## Hook example

A minimal OpenCode plugin that strips EOS tokens from local model output.
Import `@sffmc/shared`, declare a config interface with defaults, register
Import `@sffmc/utilities`, declare a config interface with defaults, register
on the `experimental.text.complete` hook, and mutate the output.

```ts
import { loadConfig, type PluginContext } from "@sffmc/shared"
import { loadConfig, type PluginContext } from "@sffmc/utilities"

interface EosConfig { markers: string[] }
const defaults: EosConfig = { markers: ["<|im_end|>", "<|endoftext|>"] }
Expand All @@ -218,7 +213,7 @@ Register it in `~/.config/opencode/opencode.json`:
"plugin": [
"file:///path/to/SFFMC/packages/safety/src/index.ts",
"file:///path/to/SFFMC/packages/memory/src/index.ts",
"file:///path/to/SFFMC/packages/agentic/src/index.ts"
"file:///path/to/SFFMC/packages/runtime/src/index.ts (or packages/cognition/src/index.ts — both work)"
]
}
```
Expand Down Expand Up @@ -281,7 +276,7 @@ test requirements, code style, and PR checklist.
SFFMC ports features from [XiaomiMiMo/MiMo-Code](https://github.com/XiaomiMiMo/MiMo-Code).
All ported features retain their original upstream attribution in source-file
headers. The SFFMC team contributed the composite-package composition layer
(`mergeHooks`), the `@sffmc/shared` SDK, and four original sub-features:
(`mergeHooks`), the `@sffmc/utilities` SDK, and four original sub-features:
auto-max, eos-stripper, log-whitelist, and health.

| Capability | SFFMC package | Description |
Expand All @@ -291,9 +286,9 @@ auto-max, eos-stripper, log-whitelist, and health.
| Memory | `@sffmc/memory` | FTS5 SQLite + context recall at session start |
| Checkpoint | `@sffmc/extra` | 200K resume with schema migration |
| Judge | `@sffmc/extra` | Multi-criteria verdict with streaming mode |
| Max Mode | `@sffmc/max-mode` | Parallel drafts + judge selection |
| Max Mode | `@sffmc/cognition/max-mode` | Parallel drafts + judge selection |
| Dream | `@sffmc/extra` | Cluster naming + memory cleaning |
| Compose | `@sffmc/compose` | 18 markdown skills |
| Compose | `@sffmc/cognition/compose` | 18 markdown skills |
| Dynamic Workflow | `@sffmc/workflow` | Sandboxed JS orchestrator |

## License
Expand Down
Loading
Loading