Development
Requirements
- Go 1.27 or newer
make- no C toolchain: builds use
CGO_ENABLED=0 - dependencies are committed under
vendor/, so builds need no network
Build and test
make
make test
make fuzz
go vet ./...
gofmt -w <files>
make writes a static bin/mob3. make clean removes it. make vendor
regenerates vendor/ after a dependency change and must be committed.
make hooks points Git at .githooks/; its pre-commit hook rejects a staged
file above 2 MB (the generated vendor/ tree is exempt), and CI runs
.githooks/check-large-files --all over every tracked file so --no-verify
cannot slip one through. Compress or split the file instead.
Tests must not require network access. Use the existing fake loader and
httptest-free helpers where possible. Add or update tests in the same change
as behaviour. Test data is synthetic: invent names, copy, values and figures.
Never paste a real page's text, labels, pricing or other identifying details
into a test or golden fixture, even without its domain.
Efficiency target
The product goal is to cover most of the features people actually use while
using far less CPU and memory than a mainstream browser. Concretely, when a
choice is ambiguous, prefer the cheap approximation over the exact but
expensive implementation, keep idle pages asleep, cap unbounded work, and never
trade a large steady-state footprint for a marginal feature. See the working
agreement in AGENTS.md for the rule in force.
Measure locally, before and after, whenever a change touches the draw loop,
timers, layout, the style pass or the JavaScript runtime. Comparing wall time,
peak RSS and idle CPU on the same machine and the same pages is what matters;
do not record hardware- or corpus-specific figures in the docs, because they go
stale and invite false comparisons. Permanent scroll guards live in internal/engine/scroll_perf_test.go:
TestScrollMovementDoesNotRebuild fails when a scroll step rebuilds the layout
or paints outside the viewport, and the image-batch tests verify that scrolling
coalesces pending image rebuilds. These gates use structural state only, so the
same change passes or fails on every machine, CPU and memory size; they do not
assert wall time or allocation counts. The BenchmarkScroll* set covers text,
block-art images and the frame/presenter seam for same-machine before/after
comparison. Run the gates and benchmarks before and after changes to the draw
loop, layout, style, image or frame code:
go test ./internal/engine -run 'TestScroll|TestDeferredImage'
go test ./internal/engine -run '^$' -bench 'BenchmarkScroll' -benchmem
make
ls -l bin/mob3
TIMEFORMAT='%3R s'; time (for i in $(seq 20); do bin/mob3 -version >/dev/null; done)
/usr/bin/time -v bin/mob3 -dump -width 177 -no-color page.html >/dev/null
Peak RSS in -dump includes Go GC headroom and is higher than a settled
interactive session, so compare like with like. For settled interactive RSS and
idle CPU, run the browser inside a pseudo terminal
(script -qec "bin/mob3 FILE" /dev/null), take the mob3 PID from pgrep,
and compare fields 14+15 of /proc/<pid>/stat (utime + stime) over a window: an
idle page must not consume measurable CPU. Per-phase parse, layout and live-heap
attribution comes from a temporary zz_*_test.go benchmark following the
debugging recipe in docs/agents/debugging.md; delete it afterwards.
Documentation
README.mdis the short landing page: what MOB3 is, how to run it, and what to expect.docs/holds long-form documentation.mob3 -hand the in-appabout:helppage are canonical for flags and keys.docs/cli.mdanddocs/keys.mdmust stay in sync.docs/automation.mddocuments the MCP tools. Tool names come frommcpToolDefinitions()ininternal/app/mcp.go.AGENTS.mdis the agent entry point; domain-specific engine, UI, network, build and JS decisions live underdocs/agents/and are not published by the site build.- The GitHub Pages site is generated from
README.mdanddocs/*.mdby.github/pages/build.sh, using pinnedmarked.
Build the site locally:
.github/pages/build.sh /tmp/mob3-site
The script writes index.html, docs/*.html, search-index.js, robots.txt,
sitemap.xml, the favicon and social-preview files under assets/, a CNAME
for mob3.net and .nojekyll. Relative .md links are rewritten to .html
for the site. Docs pages share a generated sidebar, on-page “On this page”
contents list and a compact search box at the right edge of the header, with
Docs, GitHub, Releases and Contact links, a light/dark theme toggle after the
search and a mobile menu. Each docs page also ends with an “Edit this page on
GitHub” link to its Markdown source. On phones the search is dropped so the
whole header stays on one line. Every page carries a canonical URL, description, Open
Graph and Twitter card tags and JSON-LD structured data, so search results and
link previews use the intended title, summary and 1200×630 image. The assets
under .github/pages/assets/ and the README screenshots under
docs/screenshots/ are committed; replace og-image.png when the hero
screenshot changes.
Repository layout
| Path | Purpose |
|---|---|
cmd/mob3/ |
Executable entry point |
internal/engine/ |
HTML, CSS, layout, rendering, JS/DOM, PDF, images, loader, session, automation and dump |
internal/host/ |
Network, cookies, cache, certificates, settings and request log |
internal/frontend/ |
Terminal, input, chrome, ANSI/PNG and native images |
internal/app/ |
Flags, mode dispatch, wiring, MCP transport and dump output |
internal/protocol, internal/textedit, internal/textwidth, internal/movekeys, internal/profile |
Wire types and transports; pure line editing, terminal-cell arithmetic and movement; opt-in profile storage |
docs/ |
User documentation |
.github/pages/ |
GitHub Pages template and build script |
vendor/ |
Committed Go dependencies |
bin/ |
Local build output (ignored) |
Key engine files are listed in docs/agents/architecture.md. The MCP and
automation split is:
internal/engine/automation*.go— headless browser commands, text snapshots, forms, waits and inspectioninternal/app/mcp.go— MCP/JSON-RPC framing; tool calls go throughautomationRunnerandAutomation.RunCommandinternal/app/app.go— flags, validation and the build version;execute.godispatches to interactive, dump or MCP, andrun_mcp.gostarts the automation session
Workflows
CIruns gofmt,go vetand tests on pushes tomainand pull requests.Vulnerability scanrunsgovulnchecknightly and on manual dispatch; it downloads the scanner and needs network access, while the normal build/test job stays vendored and offline.PRrequires the exact CLA statement described inCONTRIBUTING.md.Release binariesbuilds seven targets onv*tags.Dockerpublishes the multi-arch image after a successful release.GitHub Pagesrebuildsmob3.netfromREADME.mdanddocs/when they change.
Contributing
Read CONTRIBUTING.md before opening a pull request. Contributions require the
broad license-grant CLA so the project can remain available under AGPL-3.0-only
or a commercial license. Keep the working agreement in AGENTS.md and the
engine decisions under docs/agents/ current whenever behaviour changes.