use-bms
Skill1 starsChanged 3 months agoMITView on GitHub
Build and drive the yaBMS `c/bms` CLI on Linux — expand a Bashicu Matrix by a bracket, check whether a matrix is standard, compare two matrices, and search for expansion loops, across BMS versions 4 / 3.3 / 2 / 1.1 / DBMS. Use whenever a task involves expanding, comparing, standard-checking, or loop-hunting Bashicu Matrices, or asks to run yaBMS.
In this repository15 other files it gives its agents.
- autonomy-statSkill
- check-usageSkill
- compact-unfreezeSkill
- edit-statuslineSkill
- formalization-statement-fidelity-auditSkill
- get-contextSkill
- github-math-checkSkill
- heart-beatSkill
- manim-ttsSkill
- mermaidSkill
- my-github-md-ruleSkill
- nostrSkill
- sessiondbSkill
- use-fandomSkill
- webapp-defaultsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
All paths below are relative to a yaBMS checkout.
- Very specific: line 37
Check that the binary exists before running anything.
- Distinctive: line 55
Always quote the argument in the shell — parentheses are shell metacharacters.
- Distinctive: line 59
All forms take the matrix as the last positional argument(s).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
← Back | English | Japanese
use-bms
Drive the bms C command in c/ of the yaBMS repository. Target: Linux (also
WSL). The MCP server in mcp/ is a separate, optional path — do not use it for
these tasks.
Locate the repository
All paths below are relative to a yaBMS checkout. Find it in this order:
- the current working directory, if it contains
c/bms.c; ~/code/yaBMS;- otherwise clone it —
git clone https://github.com/koteitan/yaBMS.git.
This skill is mirrored in ~/my-skills, so it may be active outside the yaBMS
tree. Never assume the skill directory sits inside the checkout.
Build first
bms is not committed; it must be compiled before any use.
cd <repo>/c
make # gcc -O0 -g -std=c99 -o bms bms.cRequires gcc only — no libraries beyond libc. Re-run make after editing
bms.c / bms.h. make clean removes the binary.
Check that the binary exists before running anything; if ./bms is missing,
run make rather than reporting a failure.
Input syntax
A Bashicu Matrix is written as consecutive parenthesised columns, optionally followed by brackets:
(0,0,0)(1,1,1)(2,1,0)(1,1,1)[2]
\_____ columns _____________/ \_ bracket- Each
(...)is one column; the numbers inside are the rows. - Every column must have the same number of rows. A mismatch prints
error:ys mismatchand then segfaults. [n]is the expansion count. Multiple brackets[2][1]are allowed and are consumed left to right (see-r).- Always quote the argument in the shell — parentheses are shell metacharacters.
Commands
All forms take the matrix as the last positional argument(s).
| Task | Command |
| Expand | ./bms [-e] [-d] [-r] [-v ver] "<bm>" |
| Standard check | ./bms -s [-d] [-v ver] "<bm>" |
| Compare | ./bms -c [-d] "<bm0>" "<bm1>" |
| Loop check (single) | ./bms -l [-d] [-v ver] "<bm>" |
| Loop search (range) | ./bms -lr [-d] [-v ver] "<bm0>" "<bm1>" [<depth>] |
| Help | ./bms -h (add -d for copyright) |
Options combine into one token (-sd, -lrd, -ed, -lrdv 1.1).
Expand — -e (default)
Expansion is the default when no command flag is given, so -e is optional.
$ ./bms "(0,0,0)(1,1,1)(2,1,0)(1,1,1)[2]"
(0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,2,0)(2,2,0)(3,3,1)(4,3,0)-r keeps expanding while brackets remain, printing every intermediate step:
$ ./bms -r "(0)(1)(2)(3)[1][1][1][1]"
(0)(1)(2)(2)[1][1][1]
(0)(1)(2)(1)(2)[1][1]
(0)(1)(2)(1)(1)[1]
(0)(1)(2)(1)(0)(1)(2)(1)-d prints the internal decomposition (parent index matrix, good/bad part, bad
root, lnz, delta, ascension matrix) before the result.
Standard check — -s
Prints 1 if the matrix is standard, 0 otherwise. With -d, prints the
comparison trace and standard. / non-standard. instead.
$ ./bms -s "(0)(1)"
1
$ ./bms -s "(1)"
0Compare — -c
Prints 1 / 0 / -1 for bm0 > bm1 / == / <. Brackets are ignored, and
so is -v (comparison is version-independent).
$ ./bms -c "(0,0)(1,1)(2,0)" "(0,0)(1,1)(1,1)"
1
$ ./bms -cd "(0,0)(1,1)(2,0)" "(0,0)(1,1)(1,1)"
(0,0)(1,1)(2,0) > (0,0)(1,1)(1,1)Loop finding — -l, -lr
-l <bm> first expands the matrix until no brackets remain, then reports 1 if
the result loops (gets no smaller under a further expansion), 0 otherwise.
-lr <bm0> <bm1> [depth] searches for a loop from bm1 down to bm0 within
depth expansions (default 3). Detection is heuristic and may miss loops.
Runtime grows sharply with depth — start at 3–5 and always wrap deep searches
in timeout.
$ ./bms -lr "(0,0,0)(1,1,1)(2,1,0)" "(0,0,0)(1,1,1)(2,1,0)(1,1,1)" 3
0Versions — -v
-v {4 | 3.3 | 2 | 1.1 | DBMS}, default 4. Aliases are accepted: 4.0,
2.3, BM4, BMS4, BM2.0, DBM, DBMS4.0, and so on. An unrecognised
value is silently ignored and version 4 is used — verify with -d, which
prints version = BM4.
Versions differ only on some matrices; expect identical output on simple ones.
$ ./bms -v3.3 "(0,0,0)(1,1,1)(2,1,0)(1,1,1)[2]"
(0,0,0)(1,1,1)(2,1,0)(1,1,0)(2,2,1)(3,1,0)(2,2,0)(3,3,1)(4,1,0)Gotchas
These are real behaviours of the current binary — check for them rather than assuming clean CLI semantics.
- No bracket, no output.
./bms "(0,0)(1,1)"prints nothing and exits0. The expand loop runs only while brackets remain. Do not read an empty result as a crash; add a[n]. -lrprints without a trailing newline (plain0/1).-l,-s,-cand expansion all do end with a newline. Use$(...)capture, not line-oriented reads, for-lr.- Errors report through stdout and exit code, not stderr. Missing operands
print
error: input is not enough.and exit1. Theys mismatchmessage is the one that goes to stderr, and it is followed by a segfault (exit139). - No bounds checks.
bms.hfixesBMS_ELEMS_MAX 4096(total row×column entries) andBMS_BRACKETS_MAX 256. Exceeding either corrupts the heap and aborts (munmap_chunk(): invalid pointer,malloc(): corrupted top size). For a 3-row matrix that is 1365 columns. Keep inputs well under the limits, and treat a crash on a large matrix as an overflow, not a bug in the input. ./bmswith no arguments prints help and exits0— same as-h.- Exit code is
0for every successful run regardless of the answer; the verdict is on stdout. Do not branch on$?to read a result.
Iterating expansions
To walk a fundamental sequence, feed the output back with the next bracket:
bm="(0,0)(1,1)(2,2)"
for n in 1 2 3 4; do
bm=$(./bms "$bm[$n]")
echo "n=$n $bm"
doneMatrices grow fast; guard long runs with timeout and check the size against
the 4096-entry limit before the next step. c/example.sh is a worked example of
batching a version sweep across depths.
Reference
c/README.md— upstream feature documentation with examples.c/bms.h— array limits, version enum, function contracts.mcp/doc/what-is-bms.md— what a Bashicu Matrix is, the matrix↔ordinal correspondence table, and what expansion means. Read this when the task needs the mathematics rather than the CLI.make docinc/builds Doxygen output (needsdoxygen).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

