Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
GIT_REMOTE=ssh://git@git.example.invalid/your-team/knowledge.git
GIT_BRANCH=main
HINDSIGHT_PORT=8080
# Pin a release instead of :latest, e.g. ghcr.io/drdroidlab/hindsight:0.1.0
# HINDSIGHT_IMAGE=ghcr.io/drdroidlab/hindsight:latest
SYNC_INTERVAL=60
STALE_AFTER_DAYS=90
READ_ONLY=false
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: release-image
# A v* tag pushes ghcr.io/drdroidlab/hindsight:<version>, :<major>.<minor> and :latest
# (latest is skipped for pre-releases). A manual run builds both platforms without pushing.
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-image-${{ github.ref }}
cancel-in-progress: false
env:
IMAGE: ghcr.io/drdroidlab/hindsight
jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Check tag matches project version
if: github.ref_type == 'tag'
run: |
version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match pyproject.toml version ${version}"
exit 1
fi
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=sha,enable=${{ github.event_name == 'workflow_dispatch' }}
labels: |
org.opencontainers.image.title=Hindsight SRE
io.modelcontextprotocol.server.name=io.github.DrDroidLab/hindsight-sre
- name: Build amd64 image for the smoke test
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
load: true
tags: hindsight-sre:ci
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run offline seeded demo smoke
run: python3 scripts/demo-smoke.py --image hindsight-sre:ci
- if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build multi-arch image and push on tags
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max
108 changes: 108 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: release-pypi
# A v* tag publishes hindsight-sre to PyPI and creates the GitHub release.
# A manual run publishes a .devN build of the current version to TestPyPI as a dry run.
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-pypi-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Check tag matches project version
if: github.ref_type == 'tag'
run: |
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match pyproject.toml version ${version}"
exit 1
fi
if ! python -c 'import json, sys; s = json.load(open("server.json")); sys.exit(any(v != sys.argv[1] for v in [s["version"], *(p["version"] for p in s["packages"])]))' "${version}"; then
echo "::error::server.json versions do not match pyproject.toml version ${version}"
exit 1
fi
- name: Use a unique dev version for the TestPyPI dry run
if: github.event_name == 'workflow_dispatch'
run: sed -i -E "s/^version = \"([^\"]+)\"/version = \"\1.dev${GITHUB_RUN_NUMBER}\"/" pyproject.toml
- run: pip install 'build>=1' 'twine>=6'
- run: python -m build
- run: twine check --strict dist/*
- name: Check wheel bundles the UI and sample knowledge
run: |
python - <<'EOF'
import glob, zipfile
names = zipfile.ZipFile(glob.glob("dist/*.whl")[0]).namelist()
required = ["hindsight/static/index.html", "hindsight/static/assets/app.js"]
missing = [n for n in required if n not in names]
if not any(n.startswith("hindsight/sample-knowledge/") for n in names):
missing.append("hindsight/sample-knowledge/")
if missing:
raise SystemExit(f"wheel is missing: {missing}")
EOF
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error

publish-testpypi:
if: github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/hindsight-sre
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-pypi:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/hindsight-sre
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1

github-release:
if: github.ref_type == 'tag'
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create GitHub release with the built distributions
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "$GITHUB_REF_NAME" dist/*
--repo "$GITHUB_REPOSITORY" --verify-tag --generate-notes
--title "$GITHUB_REF_NAME"
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends git openssh-cli
&& mkdir -p /data /opt/hindsight \
&& chown -R hindsight:hindsight /data /opt/hindsight
COPY --from=python-build /install/ /usr/local/
LABEL org.opencontainers.image.title="Hindsight SRE" \
io.modelcontextprotocol.server.name="io.github.DrDroidLab/hindsight-sre"
USER 10001:10001
WORKDIR /opt/hindsight
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 HINDSIGHT_DATA_DIR=/data DATA_DIR=/data
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- mcp-name: io.github.DrDroidLab/hindsight-sre -->

<p align="center">
<img src="docs/assets/logo.svg" width="64" height="64" alt="Hindsight logo">
</p>
Expand Down Expand Up @@ -41,22 +43,23 @@ Everything is typed Markdown in a git remote you control, every commit carries t

## Quickstart

Requires Docker with Compose v2 and git. The demo runs offline with a seeded sample repo, no model provider and no git credentials.
Requires Docker with Compose v2. The demo pulls the published image (`ghcr.io/drdroidlab/hindsight`) and runs offline with a seeded sample repo, no model provider and no git credentials.

```sh
git clone https://github.com/DrDroidLab/hindsight.git
cd hindsight
docker compose -f compose.yaml -f compose.demo.yaml up --build -d
mkdir hindsight && cd hindsight
curl -fsSLO https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.yaml -O https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.demo.yaml
docker compose -f compose.yaml -f compose.demo.yaml up -d
docker compose exec hindsight hindsight admin bootstrap
```

Open <http://localhost:8080/setup>, paste the enrollment token, save the API key shown once, and sign in. Then approve the proposed clue and promote it to the CrashLoopBackOff runbook. If port 8080 is busy, set `HINDSIGHT_PORT` before `up`.

### Connect your agent

Each engineer installs the `hindsight-sre` CLI from PyPI (`pipx install hindsight-sre` works too):

```sh
python3.12 -m venv .venv && . .venv/bin/activate
pip install .
uv tool install hindsight-sre
hindsight login --server http://localhost:8080 --scope shared
hindsight install claude --server http://localhost:8080 # or cursor, codex, gemini
```
Expand Down Expand Up @@ -92,6 +95,8 @@ Early-stage, v0.1. The automated suite (Python, frontend, and an offline Docker

## Development

Working from a clone, `docker compose up --build` builds the image from your checkout instead of pulling it.

```sh
pip install -e '.[dev]'
npm ci --prefix web && npm run build --prefix web
Expand Down
4 changes: 3 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Pulls the published image. From a clone, `docker compose up --build` builds this checkout instead;
# set HINDSIGHT_IMAGE to pin a release, e.g. ghcr.io/drdroidlab/hindsight:0.1.0.
services:
hindsight:
image: hindsight-sre:local
image: ${HINDSIGHT_IMAGE:-ghcr.io/drdroidlab/hindsight:latest}
build: .
restart: unless-stopped
init: true
Expand Down
36 changes: 20 additions & 16 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
seo_title: "Quickstart: install Hindsight with Docker and connect your coding agent"
description: >-
Install Hindsight with Docker Compose, run the offline demo, connect Claude
Install Hindsight with Docker Compose and the hindsight-sre CLI, run the offline demo, connect Claude
Code, Cursor, Codex or Gemini CLI over MCP, and deploy against your own git
remote.
---
Expand All @@ -12,26 +12,28 @@ This page gets you from nothing to an agent recalling reviewed knowledge. The [d

## Prerequisites

- Docker with Compose v2
- git
- Docker with Compose v2 (team lead, to run the server)
- A browser
- A free loopback port. The default is 8080; set `HINDSIGHT_PORT` to use another.
- Python 3.12+ for the client CLI that connects agents
- [uv](https://docs.astral.sh/uv/) or [pipx](https://pipx.pypa.io/) for the client CLI that connects agents (each engineer). It needs Python 3.12+, which uv installs for you if it is missing.

The first image build needs network access for dependencies. The running demo needs no remote git, no model provider and no production access.
Pulling the image needs network access. The running demo needs no remote git, no model provider and no production access.

## 1. Run the demo server

```sh
git clone https://github.com/DrDroidLab/hindsight.git
cd hindsight
docker compose -f compose.yaml -f compose.demo.yaml up --build -d
mkdir hindsight && cd hindsight
curl -fsSLO https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.yaml -O https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.demo.yaml
docker compose -f compose.yaml -f compose.demo.yaml up -d
docker compose exec hindsight hindsight admin bootstrap
```

If port 8080 is taken, prefix the `up` command with `HINDSIGHT_PORT=8091` (or any free port) and use that port below.
Compose pulls `ghcr.io/drdroidlab/hindsight:latest`. To pin a release, set `HINDSIGHT_IMAGE=ghcr.io/drdroidlab/hindsight:<version>`. If port 8080 is taken, prefix the `up` command with `HINDSIGHT_PORT=8091` (or any free port) and use that port below.

The demo creates a local bare git remote at `/data/demo-remote.git` from `examples/sample-knowledge/`. It holds seven fictional documents: the `payments-api` service, a CrashLoopBackOff runbook, an approved clue, an unreviewed clue, a skill, a resolved incident and an outcome. Running it again does not overwrite an existing remote.
!!! tip "Running from a clone"
In a checkout of the repository, `docker compose -f compose.yaml -f compose.demo.yaml up --build -d` builds the image from your working tree instead of pulling it.

The demo creates a local bare git remote at `/data/demo-remote.git` from the sample knowledge bundled in the image (`examples/sample-knowledge/` in the repository). It holds seven fictional documents: the `payments-api` service, a CrashLoopBackOff runbook, an approved clue, an unreviewed clue, a skill, a resolved incident and an outcome. Running it again does not overwrite an existing remote.

## 2. Enroll and review

Expand All @@ -48,12 +50,10 @@ Approval and promotion are two separate git commits, both authored by you.

## 3. Connect an agent

Install the client CLI in a virtual environment, log in, and install the integration for your agent:
Each engineer installs the `hindsight-sre` CLI from PyPI, logs in, and installs the integration for their agent:

```sh
python3.12 -m venv .venv
. .venv/bin/activate
pip install .
uv tool install hindsight-sre # or: pipx install hindsight-sre
hindsight login --server http://localhost:8080 --scope shared
hindsight install claude --server http://localhost:8080 --dry-run
hindsight install claude --server http://localhost:8080
Expand All @@ -77,12 +77,16 @@ hindsight review --status proposed
## 4. Deploy with your own knowledge remote

```sh
cp .env.example .env
mkdir hindsight-server && cd hindsight-server
curl -fsSLO https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.yaml
curl -fsSL https://raw.githubusercontent.com/DrDroidLab/hindsight/main/.env.example -o .env
# Set GIT_REMOTE to a dedicated, sanitized repository and configure git credentials privately.
docker compose up --build -d
docker compose up -d
docker compose exec hindsight hindsight admin bootstrap
```

Use a different directory from the demo: Compose names the data volume after the directory, so this keeps demo data out of your deployment. Pin `HINDSIGHT_IMAGE` in `.env` to a released version rather than `latest`.

`GIT_REMOTE` is the only required setting. Everything else is optional and unlocks one feature each:

| Setting | Unlocks | Without it |
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ Capture, review and full-text recall work with no LLM key. Optional extraction a
## Try it locally

```sh
git clone https://github.com/DrDroidLab/hindsight.git
cd hindsight
docker compose -f compose.yaml -f compose.demo.yaml up --build -d
mkdir hindsight && cd hindsight
curl -fsSLO https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.yaml -O https://raw.githubusercontent.com/DrDroidLab/hindsight/main/compose.demo.yaml
docker compose -f compose.yaml -f compose.demo.yaml up -d
docker compose exec hindsight hindsight admin bootstrap
```

Open `http://localhost:8080/setup`, paste the enrollment token, and review the seeded sample clue. The demo needs no git credentials, no model provider and no network once the image is built. See the [quickstart](getting-started.md) for connecting your agent.
Open `http://localhost:8080/setup`, paste the enrollment token, and review the seeded sample clue. The demo needs no git credentials, no model provider and no network once the image is pulled. See the [quickstart](getting-started.md) for connecting your agent.

## What Hindsight is not

Expand Down
2 changes: 1 addition & 1 deletion docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ There are no built-in hosting-provider PR creation/merge APIs or provider tokens

## Updating

Back up first, stop the old writer, build a new image, and restart with the same persistent volume. Do not run old and new writers against it concurrently. Check release schema notes and test restore; no automatic cross-version migration guarantee is promised. Keep client hooks and provider settings independently versioned and verify `install --check` after client upgrades.
Back up first, stop the old writer, pull the new image (`docker compose pull`, or set `HINDSIGHT_IMAGE` to the new version), and restart with the same persistent volume. Do not run old and new writers against it concurrently. Check release schema notes and test restore; no automatic cross-version migration guarantee is promised. Keep client hooks and provider settings independently versioned and verify `install --check` after client upgrades.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Issues = "https://github.com/DrDroidLab/hindsight/issues"

[project.scripts]
hindsight = "hindsight.cli:main"
# Alias matching the package name, so `uvx hindsight-sre mcp-proxy` works (MCP Registry entry).
hindsight-sre = "hindsight.cli:main"

[tool.hatch.build.targets.wheel]
packages = ["src/hindsight"]
Expand Down
Loading
Loading