Agent orientation for the Madagascar geophysical data analysis package. Authored for Claude Code, Copilot CLI, Codex, Gemini CLI. Also readable as plain project context by Cursor, Aider, Zed, and other agent harnesses.
Madagascar is an open-source package for reproducible geophysical data analysis. Research and processing are expressed as SConstruct files that chain small composable sf* programs; each program reads and writes files in the RSF format (regularly sampled data, text header + binary).
- RSF files are the data plane: one text header (
.rsf) pointing at a binary (usually in$DATAPATH). sf*programs are the compute plane: ~1,000 small Unix-style filters that read RSF on stdin and write RSF on stdout.- SConstruct flows are the orchestration plane: Python (
rsf.proj) DSL usingFlow,Plot,Result,Fetch,Command. - vplot (
.vpl) is the visualization plane:sfgrey,sfgraph,sfwiggle, etc. produce.vplfiles thatsfpendisplays.
api/— language bindings. C is the reference; 9 other languages wrap it (C++, Python, F77, F90, Java, Julia, Matlab, Octave, Chapel).framework/rsf/— the Python DSL for flows:proj.py(Flow/Plot/Result/Fetch),flow.py,tex.py.user/<author>/M<name>.[c|py|cc|f|f90|...]— user-contributed main programs.plot/main/— vplot rendering programs (grey.c,graph.c,wiggle.c,contour.c,dots.c,bargraph.c, …).book/— 1,751 example SConstructs: teaching material, tutorials, published research reproductions.system/— filesystem-level helpers (sfrm,sfcp, …).
- Text header (
file.rsf) containsn1=..., d1=..., o1=..., label1=..., unit1=...through axis 9. n1is the fastest-varying axis.- Binary data is in a separate file pointed to by
in=in the header, typically under$DATAPATH(set viaenv.sh). <redirects stdin from an RSF file;>writes to a new RSF (with its binary placed in$DATAPATH).
sconsin anybook/directory builds that directory's flow.sfdoc <progname>prints program help. Also<progname>with no args.sfin file.rsfinspects header contents.sfattr < file.rsfprints data statistics.scons viewruns the flow and opens allResultplots.
sfdoc <name>— full docs for a single program.sfdoc -k <keyword>— search docs.user/<author>/M<name>.*— read the source for how a program is built.
Create a M<name>.<ext> file in user/<youruser>/. The sf<name> binary is produced automatically by the local SConstruct. See the authoring-sf-programs skill family for details per language.
See skills/ in this repo. Each path below resolves to a SKILL.md that the Claude Code (and compatible) Skill tool can load on demand.
| Skill | When to use |
|---|---|
skills/writing-rsf-flows/ |
Writing or modifying an SConstruct that orchestrates RSF processing. |
skills/using-sf-programs/ |
Composing a pipeline from existing sf* programs. |
skills/working-with-rsf-data/ |
Inspecting, modifying, or debugging RSF headers and binaries. |
skills/plotting-with-vplot/ |
Producing or debugging a vplot visualization. |
skills/authoring-sf-programs/ |
Shared conventions for authoring a new sf* program (language-agnostic). |
skills/finding-workflow-examples/ |
Finding and adapting an end-to-end workflow from the book/ corpus. |
skills/authoring-sf-programs-c/ |
Authoring in C (reference implementation). |
skills/authoring-sf-programs-python/ |
Authoring in Python. |
skills/authoring-sf-programs-cpp/ |
Authoring in C++. |
skills/authoring-sf-programs-f90/ |
Authoring in Fortran 90. |
skills/authoring-sf-programs-f77/ |
Authoring in Fortran 77. |
skills/authoring-sf-programs-java/ |
Authoring in Java. |
skills/authoring-sf-programs-julia/ |
Authoring in Julia. |
skills/authoring-sf-programs-matlab/ |
Authoring in Matlab. |
skills/authoring-sf-programs-octave/ |
Authoring in GNU Octave. |
skills/authoring-sf-programs-chapel/ |
Authoring in Chapel. |
rm *.rsfremoves headers but leaves binaries behind in$DATAPATH. Usesfrminstead.- Axis 1 is fastest-varying;
sftranspswaps axes. - Plot labels use escape codes:
\_subscript,\^superscript,\s<n>size. Forgetting these in SConstruct strings leaves literal backslashes in output. - The
sfprefix is implicit inside aFlow()string — writebandpass, notsfbandpass. $DATAPATHmust be writable and end in/.- Complex data types (
sf_complex) requiredata_format=native_complex(orascii_complex/xdr_complex) in the header — the shorthandcomplexalone is not a valid value.