sagefs
Skill72 starsChanged 59 days agoMITView on GitHub
How to work in any F# repo when SageFs is available: the SageFs REPL (MCP) is the inner loop, dotnet build/test is only the final gate, and every change is proven in the REPL before it is written to a file. Also the house code-design standards: exhaustive DUs over option/bool, Result with a named reason over string refusals, parse-don't-validate, pure functional core with effects at the edge, hexagonal architecture, vertical slices, immutability, small composable functions, TDD red-green-refactor, and no `private` anywhere except a smart constructor. Use at the start of every F# task, when designing a type or a signature, whenever you are about to run dotnet build, dotnet test, dotnet run or dotnet fsi, whenever you are about to edit a source file with sed/python/bulk-regex instead of an exact editor call, when a SageFs tool errors, and when writing a brief for a sub-agent that will touch F#.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- skills/sagefs/agents.mdAGENTS.md
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Read
design.md: before designing a type, signature or module: the house standard for what the code should LOOK like, where a mechanically … - Very specific: line 23
Call get_daemon_status. If the tools are missing, SageFs is not connected, so tell the user.
- Very specific: line 30
Call list_sessions. A session belongs to a working directory (a git worktree is its own boundary).
- Very specific: line 32
Call get_available_projects, then create one session with create_project_session (one .fsproj), create_solution_session (a .sln or .slnx) …
- Very specific: line 61
Never #load or #r anything the session already loaded — two copies of every type, and the lock blocks rebuilds.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Working in F# with SageFs
SageFs gives you a live F# REPL with the project already loaded. An eval takes
milliseconds, a dotnet build minutes. So the REPL is the inner loop, and
dotnet build / test / run is the final gate, run once when you are done,
never to probe what an API looks like.
Before you design anything
Read design.md before designing a type, signature or module: the house
standard for what the code should LOOK like, where a mechanically correct change
can still be the wrong code. The rest of this skill is mechanics — how to DRIVE
the tool.
First minute
- Call
get_daemon_status. If the tools are missing, SageFs is not connected, so tell the user. Some clients (Claude Code) load MCP tools on demand: fetch the core ones in ONE call (get_daemon_status, list_sessions, get_available_projects, create_project_session, get_session_status, send_fsharp_code, hard_reset_fsi_session, stop_session). If the daemon's version is behind the code you are working on, tell the user. Do not restart it yourself: it is theirs and other agents may be on it. - Call
list_sessions. A session belongs to a working directory (a git worktree is its own boundary). Use yours, never create a duplicate. - Call
get_available_projects, then create one session withcreate_project_session(one.fsproj),create_solution_session(a.slnor.slnx) orcreate_bare_session(no project). SageFs builds missing generated state itself, so do not run a shell build first. - Warmup takes 15-30s. Call
get_session_statuswithwait_seconds=60: it returns once the session isReady, so no sleeping or polling. IfwaitsaysTimedOut, call again; onFaulted, act on the reason it names.
The loop
- RED:
send_fsharp_codewith the smallest thing that shows the problem, and watch it fail. - GREEN: redefine it in the session until it passes. Small blocks, each
statement ending in
;;. - Persist the working code to the
.fsfile. hard_reset_fsi_sessionwithrebuild=true, so the session runs the real file. Only after persisting or an.fsprojchange, not after every eval.- Re-verify in the session, then commit.
- Final gate, once, at the end, in the background: the full build and the
unfiltered suite,
dotnet run --project <tests>(ExpectoExe), neverdotnet test. From the session,run_testsreturns a receipt;Incompleteis not green.
Rules that bite before your first edit
- Prove a change in the REPL before you write it to a file. Eval the new logic on real input and read the output first.
- Edit with exact editor calls: read the region, replace that exact text. Never
sed -i,python3 -cor bulk regex edits: a silent no-op looks like success. - Never
#loador#ranything the session already loaded — two copies of every type, and the lock blocks rebuilds.#loadonly a pure file. - To learn an API's or AST's shape, ask the session (reflect over the type, or
parse a sample and print it). Never guess or start a
dotnet fsiscript. - "Operation could not be completed due to earlier error" means an earlier statement failed. Fix that one. Do not reset the session.
- A bare
Error/Okresolving to the wrong type is a shadowing union case: writeResult.Error/Result.Ok. - A filtered test run is never the acceptance check. A filter matching nothing
still prints
0 failedand exits 0; onlyran=proves coverage. - Acquire the matching lease before a build/test/app run you start (leases.md).
- Clean up:
stop_sessionon every session you created; kill only processes you started, by exact PID.
Orchestrator hygiene
Tidy up after sub-agents: get_workspace_hygiene before you spawn, tidy_workspace (confirm=true plus its
plan id) once their work merges. Brief them: remove nothing you do not own, report your worktree path and branch.
Read more only when you need it
| Read | When |
| design.md | before designing a type, signature or module |
| testing-standards.md | before writing the tests for a change |
| dst-capabilities.md | before writing a simulation or mutation test |
| sessions.md | choosing a session, a stale daemon, or one stuck warming |
| loop.md | the loop is unclear, or you are tempted to run dotnet build mid-task |
| editing.md | before your first edit, or on a #load error |
| testing.md | running tests from the session, or judging a green run |
| leases.md | starting a build/test/app run yourself, or a lease was denied |
| troubleshooting.md | a tool errors, or SageFs seems broken |
| claude-code.md | shell commands hit permission prompts |
| agents.md | writing a brief for a sub-agent |
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.

