statedir

package
v0.56.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const EnvHome = "MEMCODE_HOME"

EnvHome overrides the user-global memcode home (default ~/.memcode).

View Source
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

func For(root string) string

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

func Key(root string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL