freshcrate

Description

Next-Gen AI-Aware Git

README

h5i

Version control for the age of AI-generated code โ€” including the reasoning behind it.

h5i Logo

example workflow Apache-2.0

h5i (pronounced high-five) is a Git sidecar that answers the questions Git can't: Who prompted this change? What did the AI skip or defer? What was it thinking, and can we safely resume where it left off?

It currently integrates best with Claude Code and now also bootstraps Codex-oriented repo instructions and memory snapshots.

curl -fsSL https://raw.githubusercontent.com/Koukyosyumei/h5i/main/install.sh | sh
cd your-project && h5i init

Or build from source: cargo install --git https://github.com/Koukyosyumei/h5i h5i-core

Context DAG


Context Versioning

Every AI coding session starts cold. The model has no memory of the decisions made last Tuesday, the edge case it deferred, or why the session store switched to Redis. You re-explain. It re-explores. Token budgets burn.

h5i solves this by versioning reasoning alongside code. Every OBSERVE โ†’ THINK โ†’ ACT step is stored in a DAG linked to the git commit it produced. A SessionStart hook injects the relevant prior context automatically โ€” no manual copy-paste. When you come back a week later, Claude reads its own prior thinking and picks up exactly where it left off.

โ— 7216039  feat: switch session store to Redis
  model: claude-sonnet-4-6 ยท 312 tokens
  prompt: "sessions need to survive process restarts"

  Context at commit time:
    [THINK] 40 MB overhead is acceptable; survives restarts; required for horizontal scale
    [ACT]   switched session store from in-process HashMap to Redis in src/session.rs
    [NOTE]  TODO: add integration test for failover path

The full reasoning workspace โ€” goal, milestones, OTA trace, open TODOs โ€” travels with the repo. Every h5i commit snapshots it automatically. h5i context restore <sha> time-travels the reasoning back to any past commit.


What h5i does

h5i context โ€” version-controlled reasoning that survives session resets

Long-running tasks lose context when a session ends. The h5i context workspace is a Git-backed reasoning journal: every OBSERVE โ†’ THINK โ†’ ACT step is stored as a node in a directed-acyclic-graph (DAG) with explicit parent links, linked to the code commit it produced, and snapshotted automatically. It survives session resets, machine switches, and team handoffs.

Automatic context injection โ€” no manual setup per session

With the SessionStart hook installed (see Setup), h5i injects a compact orientation into every new Claude session automatically:

[h5i] Context workspace active โ€” prior reasoning follows.

  branch=main  goal=Build an OAuth2 login system
  milestones=3  commits=7  trace_lines=142+12

  m0: [x] Initial setup
  m1: [x] GitHub provider integration
  m2: [ ] Token refresh flow

[h5i] Last decisions & actions:
  [14:02] THINK: 40 MB overhead acceptable; Redis survives process restarts
  [14:03] ACT:   switched session store to Redis in src/session.rs
  [14:05] NOTE:  TODO: integration test for failover path

[h5i] Use `h5i context show` for full details.

Claude reads its own prior reasoning and resumes immediately โ€” no re-exploration, no re-explanation.

Progressive disclosure โ€” pay only for the depth you need

h5i context show --depth 1   # ~800 tokens: goal, branch, milestone IDs, counts
h5i context show --depth 2   # ~2โ€“5K tokens: + recent commits and mini-trace (default)
h5i context show --depth 3   # full OTA log โ€” equivalent to the old --trace flag

Recording reasoning during a session

# Once at project start
h5i context init --goal "Build an OAuth2 login system"

# During the session โ€” log each reasoning step
h5i context trace --kind OBSERVE "Redis p99 latency is 2 ms"
h5i context trace --kind THINK   "40 MB overhead is acceptable"
h5i context trace --kind ACT     "Switching session store to Redis"

# Scratch observations that shouldn't survive the session
h5i context trace --kind OBSERVE "checking line 42" --ephemeral

# After each meaningful milestone
h5i context commit "Implemented token refresh flow" \
  --detail "Handles 401s transparently; refresh token stored in HttpOnly cookie."

The Stop hook checkpoints the workspace automatically when a session ends โ€” even if you forget to run h5i context commit.

Context versioning โ€” time-travel your reasoning

Every h5i commit snapshots the context workspace and links it to that commit's SHA. You can restore reasoning state, diff it, or find what was being thought about any specific file:

h5i context restore a3f9c2b       # restore reasoning to the state at that commit
h5i context diff a3f9c2b 7216039  # see how reasoning evolved between two commits
h5i context relevant src/auth.rs  # find every trace entry that mentioned this file

Branch and merge reasoning threads

Explore risky alternatives without polluting the main thread โ€” exactly like git branch:

h5i context branch experiment/sync-approach --purpose "try synchronous retry as fallback"
# โ€ฆ explore โ€ฆ
h5i context checkout main
h5i context merge experiment/sync-approach   # merge node recorded in DAG

Delegate to a subagent in its own isolated scope:

h5i context scope investigate-auth --purpose "check token validation edge cases"
# subagent works here, adds its own traces โ€ฆ
h5i context checkout main
h5i context merge scope/investigate-auth

Compact the trace โ€” three-pass lossless trimming

Removes subsumed OBSERVEs, merges consecutive OBSERVEs about the same file, and preserves all THINK/ACT/NOTE entries verbatim:

h5i context pack
# โœ”  Three-pass lossless pack complete:
#    โˆ’ 12 subsumed OBSERVE entries removed
#    โ‡’  4 consecutive OBSERVE entries merged
#    โœ”  31 THINK/ACT/NOTE entries preserved verbatim

Keep the trace cache-efficient:

h5i context cached-prefix   # shows the stable-prefix / volatile-suffix boundary

Scan the trace for prompt-injection signals:

h5i context scan
โ”€โ”€ h5i context scan โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ main
  risk score  1.00  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  (48 lines scanned, 2 hit(s))

  HIGH line 31  [override_instructions]  ignore all previous instructions
  HIGH line 31  [exfiltration_attempt]   reveal the system prompt

h5i context scan applies eight regex rules โ€” role hijacking, instruction overrides, credential exfiltration, delimiter escapes, and more โ€” and reports a 0.0โ€“1.0 risk score.



Other features

  • h5i commit โ€” stores the exact prompt, model, agent, and test results alongside every diff. With hooks installed this is automatic. Add --decisions decisions.json to record why a design choice was made; --audit to run twelve pre-commit integrity rules (credential leaks, CI/CD tampering, scope creep).

  • h5i notes โ€” parses the Claude Code session log after each session and stores structured metadata linked to the commit: exploration footprint (files read vs. edited), uncertainty heatmap (every hedge with a confidence score), omissions (deferrals, stubs, unfulfilled promises), and blind-edit coverage (files modified without being read first). h5i notes review produces a ranked list of commits most in need of human review.

  • h5i policy โ€” policy-as-code at commit time. Define rules in .h5i/policy.toml (require AI provenance, enforce audit on sensitive paths, cap AI ratio per directory); h5i commit blocks and explains any violation.

  • h5i compliance โ€” generates audit-grade reports over any date range (--format html for a dark-theme HTML export). Automatically scans session thinking blocks for prompt-injection signals and tags flagged commits in the output.


Setup with Claude Code

1. MCP server โ€” native tool access

Register h5i as an MCP server so Claude Code can call h5i tools directly, without shell commands:

// ~/.claude/settings.json
{
  "mcpServers": {
    "h5i": { "command": "h5i", "args": ["mcp"] }
  }
}

This gives Claude direct access to query tools (h5i_log, h5i_blame, h5i_notes_*) and context workspace tools (h5i_context_trace, h5i_context_commit, etc.). Committing stays a CLI operation โ€” an intentional human checkpoint.

2. Hooks โ€” four lifecycle integrations

Run h5i hook setup to print the complete settings.json block. The four hooks work together:

{
  "hooks": {
    "SessionStart": [{ "hooks": [{ "type": "command", "command": "h5i hook session-start" }] }],
    "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.claude/hooks/h5i-capture-prompt.sh" }] }],
    "PostToolUse": [{ "hooks": [{ "type": "command", "command": "h5i hook run" }] }],
    "Stop": [{ "hooks": [{ "type": "command", "command": "h5i hook stop" }] }]
  }
}
Hook What it does
SessionStart Injects prior context (goal, milestones, last decisions) into every new session automatically
UserPromptSubmit Captures the user prompt so h5i commit records it without --prompt
PostToolUse Emits an OBSERVE/ACT trace entry for every file Read/Edit/Write
Stop Auto-checkpoints the context workspace when Claude stops

With all four installed, h5i runs silently in the background: every session starts with full context, every file touch is traced, and every session end is checkpointed โ€” zero manual steps.

3. Begin any session with a full situational briefing

h5i resume

Setup with Codex

h5i init now writes an AGENTS.md section that tells Codex to restore shared context at session start and sync trace data during the session.

Use the Codex helpers directly when you want the same behavior outside the generated instructions:

h5i codex prelude                 # print current shared context at session start
h5i codex sync                    # backfill OBSERVE/ACT traces from the live Codex session
h5i codex finish --summary "โ€ฆ"    # sync and auto-checkpoint the context workspace

For memory snapshots, target Codex explicitly:

h5i memory snapshot --agent codex
h5i memory diff --agent codex
h5i memory restore <oid> --agent codex
โ”€โ”€ Session Handoff โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Branch: feat/oauth  ยท  Last active: 2026-03-27 14:22 UTC
  HEAD: a3f9c2b  implement token refresh flow

  Goal: Build an OAuth2 login system
  Progress: โœ” Initial setup  โœ” GitHub provider  โ—‹ Token refresh  โ—‹ Logout

  โš   High-Risk Files  (review before continuing)
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  src/auth.rs       4 uncertainty signals  churn 80%
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘  src/session.rs    2 signals  churn 60%

  Suggested Opening Prompt
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Continue building "Build an OAuth2 login system". Completed: Initial
  setup, GitHub provider. Next: Token refresh flow. Review src/auth.rs
  before editing โ€” 4 uncertainty signals recorded in the last session.
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Web Dashboard

h5i serve        # opens http://localhost:7150

h5i web dashboard โ€” Timeline tab

The Timeline tab shows every commit with its full AI context inline: model, agent, prompt, test badge, and a one-click Re-audit button. The Sessions tab visualizes footprint, uncertainty heatmap, and churn per commit.


Documentation

See MANUAL.md for the complete command reference โ€” commit flags, integrity rules, notes subcommands, context workspace, memory management, MCP server tools and resources, sharing with your team, and the web dashboard guide.


License

Apache 2.0 โ€” see LICENSE.

Release History

VersionChangesUrgencyDate
v0.1.1## Install **Linux / macOS:** ```bash curl -L https://github.com/h5i-dev/h5i/releases/download/v0.1.1/h5i-v0.1.1-<TARGET>.tar.gz | tar -xz sudo mv h5i /usr/local/bin/ ``` **Windows:** download the `.zip`, extract `h5i.exe`, and add it to your `PATH`. ### Available targets | Target | Platform | |--------|---------| | `x86_64-unknown-linux-musl` | Linux x86_64 (static, glibc-free) | | `aarch64-unknown-linux-musl` | Linux arm64 (static, glibc-free) | | `aarch64-apple-darwin` | macOS (Apple SiliHigh4/21/2026
v0.1.0## Install **Linux / macOS:** ```bash curl -L https://github.com/h5i-dev/h5i/releases/download/v0.1.0/h5i-v0.1.0-<TARGET>.tar.gz | tar -xz sudo mv h5i /usr/local/bin/ ``` **Windows:** download the `.zip`, extract `h5i.exe`, and add it to your `PATH`. ### Available targets | Target | Platform | |--------|---------| | `x86_64-unknown-linux-musl` | Linux x86_64 (static, glibc-free) | | `aarch64-unknown-linux-musl` | Linux arm64 (static, glibc-free) | | `aarch64-apple-darwin` | macOS (Apple SiliHigh4/21/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

claude-code-safety-net๐Ÿ›ก๏ธ Enhance code safety with Claude Code Safety Net, a tool designed to identify and mitigate risks in your codebase effectively.main@2026-04-21
meerkatMeerkat - A modular, high-performance agent harness built in Rust.v0.5.2
automagik-genieSelf-evolving AI agent orchestration framework with Model Context Protocol support2.5.27
agent-link-mcpMCP server for bidirectional AI agent collaboration โ€” spawn and communicate with any AI coding agent CLI0.5.0
@sysmanager/ai-skillsAgent Skills Framework - Easy setup for AI agent capabilities and integrations (Claude, Gemini, Codex, GitHub Copilot)1.0.20