Init context
Local-first personal AI context loop for Code Agent conversations
npx -y skills add yinjialu/context-harness --skill init-contextAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Initialize a context-harness personal context home, data directories, global context files, and optional Codex/Claude Code hooks. Use when the user asks to initialize context-harness, set up a personal context system, configure automatic Code Agent conversation backup, or repair context-harness hooks.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.8 KB, as published. Nobody here has run it
Init Context
Use this skill to initialize or repair a context-harness installation. The skill can bootstrap the CLI runtime even when only the skill was installed.
Runtime Bootstrap
Before running context-harness, execute the bundled bootstrap script from this skill directory:
runtime_dir="$(bash scripts/bootstrap.sh)"
cd "$runtime_dir"
The script clones or updates the runtime repository at ~/.local/share/context-harness by default, checks out the latest released tag, and runs uv sync.
Overrides:
CONTEXT_HARNESS_RUNTIME_DIR: custom runtime checkout path.CONTEXT_HARNESS_REPO_URL: custom fork URL.CONTEXT_HARNESS_REF: custom branch, tag, or commit.CONTEXT_HARNESS_BOOTSTRAP_SKIP_UPDATE=1: skip fetch/pull.
Workflow
- Run the Runtime Bootstrap steps above. Use the returned path as the
context-harnessrepository root. - Choose the data home:
- Use
CONTEXT_HARNESS_HOMEwhen set. - Use the user's explicit path when provided.
- Otherwise use
~/.context-harness.
- Use
- Run all
uv run context-harness ...commands from the runtime repository root:
uv run context-harness --context-home <context-home> init
init also binds the data home's global-claude.md into agent-level context:
- Claude Code: adds an
@importline to~/.claude/CLAUDE.md(creating that file if absent). - Codex: adds a managed Context Harness block to
~/.codex/AGENTS.md(creating that file if absent) that tells Codex to read the same global context file at the start of new sessions.
This is idempotent and non-destructive — existing CLAUDE.md and AGENTS.md content is preserved, and re-running reports CLAUDE.md: unchanged and AGENTS.md: unchanged. After a fresh link, the user must restart Claude Code or start a new Codex session for the context to load.
- If the user wants automatic backup hooks, run these commands from the same repository root. Supported Code Agents install to user-level config by default. Use
--scope projectto install into the current project, or combine it with--project-rootto target another project:
uv run context-harness --context-home <context-home> hooks install codex
uv run context-harness --context-home <context-home> hooks install codex --scope project
uv run context-harness --context-home <context-home> hooks install codex --scope project --project-root <codex-project-root>
uv run context-harness --context-home <context-home> hooks install claude-code
uv run context-harness --context-home <context-home> hooks install claude-code --scope project
uv run context-harness --context-home <context-home> hooks install claude-code --scope project --project-root <claude-code-project-root>
- Report the data home and hook status.
Do not store user conversations or memory inside the context-harness repository unless the user explicitly chooses that path as the data home.
OKF Layout
init scaffolds an Open Knowledge Format knowledge base: it writes a root index.md and OKF-shaped templates for memory/MEMORY.md (type: Index), memory/user_profile.md (type: user) and global-claude.md (type: Personal Context). It is idempotent — re-running reports index.md: unchanged.
If the user points init at a data home that already holds pre-OKF archives (no frontmatter), upgrade it once with the idempotent migration:
uv run context-harness --context-home <context-home> migrate-okf --dry-run # preview
uv run context-harness --context-home <context-home> migrate-okf # apply