
Init Context
- 1 installs
- 3 repo stars
- Updated July 5, 2026
- yinjialu/context-harness
Initializes or repairs a context-harness personal context home, data directories, global context files, and optional Codex/Claude Code conversation-backup hooks.
About
Bootstraps the context-harness CLI runtime and sets up the personal context data home plus optional agent backup hooks. A developer uses it when setting up or repairing an automatic Code Agent conversation-context system.
- Bootstraps the runtime via bundled script, pinned to v0.1.7
- Installs Codex and Claude Code backup hooks at user or project scope
Init Context by the numbers
- 1 all-time installs (skills.sh)
- Ranked #2,479 of 3,282 Productivity & Planning skills by installs in the Skillselion catalog
- Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yinjialu/context-harness --skill init-contextAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 3 |
| Last updated | July 5, 2026 |
| Repository | yinjialu/context-harness ↗ |
What it does
Initializes or repairs a context-harness personal context home, data directories, global context files, and optional Codex/Claude Code conversation-backup hooks.
Files
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 v0.1.7, 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
1. Run the Runtime Bootstrap steps above. Use the returned path as the context-harness repository root. 2. Choose the data home:
- Use
CONTEXT_HARNESS_HOMEwhen set. - Use the user's explicit path when provided.
- Otherwise use
~/.context-harness.
3. Run all uv run context-harness ... commands from the runtime repository root:
uv run context-harness --context-home <context-home> init4. 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 project to install into the current project, or combine it with --project-root to 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>5. 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.
#!/usr/bin/env bash
set -euo pipefail
repo_url="${CONTEXT_HARNESS_REPO_URL:-https://github.com/yinjialu/context-harness.git}"
runtime_dir="${CONTEXT_HARNESS_RUNTIME_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/context-harness}"
runtime_ref="${CONTEXT_HARNESS_REF:-v0.1.7}"
skip_update="${CONTEXT_HARNESS_BOOTSTRAP_SKIP_UPDATE:-0}"
log() {
printf '%s\n' "$*" >&2
}
require_command() {
if ! command -v "$1" >/dev/null 2>&1; then
log "Missing required command: $1"
exit 1
fi
}
require_command git
require_command uv
runtime_parent="$(dirname "$runtime_dir")"
mkdir -p "$runtime_parent"
if [ -e "$runtime_dir" ] && [ ! -d "$runtime_dir/.git" ]; then
log "Runtime path exists but is not a git checkout: $runtime_dir"
log "Set CONTEXT_HARNESS_RUNTIME_DIR to another path or move the existing directory."
exit 1
fi
if [ ! -d "$runtime_dir/.git" ]; then
log "Cloning context-harness runtime into $runtime_dir"
git clone "$repo_url" "$runtime_dir" >&2
fi
cd "$runtime_dir"
if [ "$skip_update" != "1" ]; then
log "Updating context-harness runtime"
git fetch --tags --prune origin >&2
fi
if [ -n "$runtime_ref" ]; then
log "Checking out $runtime_ref"
git checkout --quiet "$runtime_ref"
elif [ "$skip_update" != "1" ]; then
log "Fast-forwarding current branch"
git pull --ff-only >&2
fi
log "Preparing Python environment with uv"
uv sync >&2
printf '%s\n' "$runtime_dir"