- Erlang 92.8%
- Shell 4.6%
- Dockerfile 2.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 6s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 4m31s
build-and-push / guard-1 (push) Successful in 7s
build-and-push / guard (push) Successful in 0s
c4 model / c4-model-1 (push) Successful in 4s
c4 model / c4-model (push) Successful in 0s
build-and-push / check (push) Successful in 4m42s
build-and-push / test (push) Successful in 0s
build-and-push / Release (forge, v* tag) (push) Has been skipped
lint-and-test / check (push) Successful in 4m47s
|
||
| .github | ||
| apps | ||
| architecture | ||
| assets | ||
| config | ||
| deploy | ||
| scripts | ||
| .gitignore | ||
| .tool-versions | ||
| CHANGELOG.md | ||
| Containerfile | ||
| LICENSE | ||
| README.md | ||
| rebar.config | ||
mcl-scribe
The scribe for a team's knowledge, as a mesh service. Every lesson enters through mcl-scribe once: generalized, leak-scanned, de-duplicated, stored in mcl-rag and linked in mcl-graph. A member starting a package gets a short, sourced brief back.
It uses two engines, each for the job it can do: a small local language model (on ollama, CPU is enough) for the text work, and a faber-tweann ranker that learns from outcomes which lessons are worth showing. Version 1 ranks with fixed rules and logs every input and outcome; version 2 evolves the ranker from that log.
Status: version 1, slice 1 (walking skeleton). record_lesson and lesson_status
run end to end with no model: a lesson is stored in mcl-rag as written once it passes the
leak scan, or refused naming what it carries. The model, the duplicate judgement, mcl-graph,
the corpus push, the brief and the ranker are later slices. The design is on
the design issue.
Run it on your own hardware
One container is the whole install: no model, no GPU, no API key, no database server. You need a realm to run in (its 64-hex tag and public key), a station to dial (its address and node id), an mcl-rag in the same realm, and a leak rules file.
MCL_REALM=<64-hex realm tag> \
MCL_REALM_KEY=<hex of the realm's public signing key> \
MACULA_STATION_SEEDS=station.example:4433 \
MACULA_STATION_NODE_IDS=<64-hex node id of that station> \
MCL_LEAK_RULES_FILE=$PWD/leak-rules \
docker compose -p mcl-scribe -f deploy/docker-compose.yml up -d
deploy/docker-compose.yml is the run contract. The data
volume (MCL_DATA, ./mcl-scribe-data by default) holds the scribe log: every lesson and
its state, replayed at boot. Lose it and you lose the lessons. The node identity is minted on
first start into the named volume mcl-scribe-secrets, so the node id survives a recreate.
MCL_RAG_ORG names the mcl-rag the lessons go to (mcl-rag by default: the realm's own).
Check it with scripts/health.sh, or read /health on /run/mcl/health.sock; it reports
degraded and says why when the leak rules file cannot be read.
The store's mode, and the node order over more than one
The scribe log is one reckon-db store. By default it is single: one store on this node's
data volume, and each node runs its own filer over its own log. A release that runs
mcl-scribe on several nodes can make the log one replicated store instead, by naming the
mode in the release config, the same way on every node of that cluster:
{mcl_scribe, [{store_mode, cluster}]}.
In cluster mode every node sees every lesson, so one filer files them all. Two rules come with it, both from reckon-db's join guard (a store that holds events is never allowed to join, because a join would wipe it):
- Start the node whose store holds the data first. A holder is refused every join,
including a join to a cluster that has already formed. If the empty nodes meet each other
first they form a cluster of their own, and the node holding the lessons can never join it:
stop the empty nodes, remove the store's own subdirectory (
mcl_scribe_store/) from their data volumes, and start them again while the holder is up. - A cluster-mode node does not serve until it has joined. Its boot waits until the store
is a joined cluster (a live leader, more than one member, the local Raft server answering),
so no lesson is written into the window a join would wipe. It says what it is waiting for
every few seconds (
scribe_store_not_joined), and it takes no lessons until the wait ends.
The leak rules
A plain text file, mounted read-only, one rule per line, <kind> <term>:
# people, agents, hosts, paths, emails, private repositories, issue references
person Alice Example
agent scout
host box1.internal
path /home/alice
email alice@example.org
repo acme/private-plans
issue acme/private-plans#12
Blank lines and lines starting with # are skipped. The seven kinds above are the only
kinds. A term matches as a whole term, whatever its case: next to it there may be no letter
or digit (in any script), and punctuation of any kind, curly quotes and dashes included, is
an edge. A path rule names the directory and everything under it; a trailing / is
dropped. The file must be UTF-8. It is read for every lesson, so an edit applies to the next
lesson without a restart.
The scan fails closed. A file that is missing, unreadable, not UTF-8 or malformed (an
unknown kind, a kind with no term, named by its line) stores nothing, and neither does a
file with no rules in it: an empty gate is open by accident. Every lesson stays
queued until the file is fixed, none is lost, and /health reads degraded with the
reason (no_rules for an empty file).
The procedures
| Procedure | Takes | Returns |
|---|---|---|
mcl-scribe/record_lesson |
text: the lesson, as written |
lesson_id and state: queued, at once |
mcl-scribe/lesson_status |
lesson_id |
state: queued, stored or refused, with reason when refused |
Both are granted to the realm's members only, and both require a confidential (sealed) call.
An empty lesson, one that is not UTF-8, or one over the size limit in record_lesson_v1
is refused at the door and never enters the log.
Architecture
The C4 model is in architecture/README.md.
License
Apache-2.0, see LICENSE.