Documentation
¶
Overview ¶
Package statedir decides where memcode keeps a project's state. memcode does not write into the user's folders: everything it records about a project (sessions, the index, approvals, jobs, checkpoints, worktrees) lives in the user-global home, one directory per project, keyed by the project's path:
~/.memcode/projects/-Users-me-code-app/
The one thing that still lives in the project is <root>/.memcode/tasks: an autonomous task is a standing instruction a team reviews and commits like code, so it belongs with the code (see internal/task).
Leaf package on purpose (stdlib only): everything that touches project state imports it, and config imports half the tree.
Index ¶
Constants ¶
const EnvHome = "MEMCODE_HOME"
EnvHome overrides the user-global memcode home (default ~/.memcode).
const LegacyName = ".memcode"
LegacyName is the per-project directory memcode used to create inside the project. Only tasks/ remains there; anything else is migrated out by Migrate.
Variables ¶
This section is empty.
Functions ¶
func For ¶
For returns the state directory for the project at root. It is not created; writers MkdirAll as they always have. The first lookup for a root in a process silently moves any state an older memcode left in the project (Migrate), so every reader and writer sees the global directory, whatever the entry point.
func Home ¶
func Home() string
Home is the user-global memcode directory: $MEMCODE_HOME, else ~/.memcode. Under `go test` it never resolves to the developer's real home: a test that redirected HOME gets $HOME/.memcode, any other test a per-process temp dir.
func Key ¶
Key turns a project root into its directory name under projects/: the absolute, cleaned path with separators (and a drive colon) replaced by '-', so it stays readable ("-Users-me-code-app").
func Migrate ¶
func Migrate(root string)
Migrate moves state an older memcode left inside the project (<root>/.memcode/*) into For(root), once per process (For does this itself). tasks/ stays in the project. It is idempotent and best-effort: a failure leaves the old directory in place and memcode simply starts fresh state in the global directory. Nothing is deleted unless it was moved first.
Types ¶
This section is empty.