Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bb3f352
feat: Go context-engineering core (cache/reduce/extract/proxy)
Jun 24, 2026
8eb7f2e
feat(tokens): use tiktoken-go o200k_base instead of chars/4 estimate
Jun 24, 2026
015ef1c
feat(treesitter): CGO tree-sitter wrapper (LangForExt + Parse, fail-o…
Jun 24, 2026
8a751b7
feat(reduce): tree-sitter symbol extraction (catches methods, ignores…
Jun 24, 2026
6ef47a0
feat(reduce): tree-sitter code skeletonization (keep signatures, drop…
Jun 24, 2026
2ab8eba
feat(reduce): add TOON to the format re-encoder candidates (pinned to…
Jun 24, 2026
f76e3e1
feat(extract): Starlark code-writing extractor over full output (sand…
Jun 24, 2026
9de45e5
fix(extract): goal-aware extraction cache key; full-body strategies a…
Jun 24, 2026
8515576
feat(cheapmodel): OpenAI client + first-text-block selection; --extra…
Jun 24, 2026
21f6269
fix: rune-safe truncation, precompiled pathReferenced regex, proxy bo…
Jun 24, 2026
d86b2e2
build: enable CGO for tree-sitter (CI + distroless/base + Makefile)
Jun 24, 2026
27ff2f6
fix(proxy): wire MaxBodyBytes + UpstreamTimeout flags into the binary
Jun 24, 2026
1d6c7d2
feat(cheapmodel): support bearer auth for gateway endpoints
Jun 24, 2026
3717835
chore: phase-2 plan + ledger
Jun 24, 2026
2d646f7
feat(config): YAML config file with named component selection
Jun 24, 2026
1183ff9
feat(observability): aggregate + expose token/cost/latency stats via …
Jun 24, 2026
cbc7b16
feat(bench): real-fixture measurement harness + offline results
Jun 24, 2026
c90111d
feat(bench): real haiku extractor measurement mode + results
Jun 24, 2026
44d261e
docs(claude-code): real integration run + repro script (/stats, do-no…
Jun 24, 2026
f846a8a
docs(swe-bench): validated eval-containers wiring + honest runbook
Jun 24, 2026
e8f5b1c
docs: README + RUNNING + consolidated RESULTS
Jun 24, 2026
ce42f81
fix(observability): /stats reduction_ratio = saved/before (not after/…
Jun 24, 2026
ddda100
docs: real Bob + Claude Code integration runs (savings + correctness)
Jun 24, 2026
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
51 changes: 0 additions & 51 deletions .github/workflows/build-agent.yaml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
build-test:
runs-on: ubuntu-latest
env:
CGO_ENABLED: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25'
check-latest: true
- name: Lint
run: make lint
- name: Test
run: make test
- name: Build
run: make build

trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Trivy filesystem scan
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: fs
ignore-unfixed: true
severity: CRITICAL,HIGH
exit-code: '1'
44 changes: 0 additions & 44 deletions .github/workflows/weekly-docker-test.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,9 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/


# Go / lab-context-engineering
/bin/
*.test
*.out
coverage.txt
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Run `make pre-commit` once to install these hooks (including commit-msg / DCO).
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-vet
- id: go-mod-tidy

- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
35 changes: 35 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# CLAUDE.md

Guidance for working in `lab-context-engineering`, a Kagenti platform component.

## What this repo is

A single **Go** core that reduces the token cost of LLM agent traffic. It ships as a
standalone proxy binary (`cmd/proxy`), an importable library (`engine`, `surfaces`), and
eval-containers wiring. Its lineage is the Python `winnow` prototype (`../winnow`), which
is the behavioral reference — port its *logic*, re-implement its transport in Go.

## Hard boundaries

- **No AuthBridge / kagenti-extensions code lives here.** That plugin is built in
`kagenti-extensions` and depends on this repo. Keep the public API (`engine`,
`surfaces`, `config`) clean and importable; never reach into another repo.
- **Fail open, always.** Any error in any stage forwards the original request untouched.
Reductions must be reversible (markers + rewind store). Never drop content that is only
*predicted* unused — `provable_only` is on by default.

## Conventions

- Go 1.25, module `github.com/kagenti/lab-context-engineering`. `make fmt lint test build`.
- Match the surrounding code's style; keep packages small and single-purpose.
- **Commits: DCO sign-off is mandatory** — `git commit -s`. Author as the repo owner.
AI attribution uses `Assisted-By:` — never `Co-Authored-By`, never a "Generated with"
line. Conventional-commit titles.
- Observability follows OpenTelemetry **GenAI semantic conventions** (`gen_ai.*`).

## Layout

`cmd/proxy` (binary) · `engine` (Transform/Expand + stages) · `surfaces` (wire⇄canonical)
· `internal/*` (types, extract, relevance, signals, taxonomy, actions, cache, markers,
rewind, zones, session, compaction, tokens) · `config` · `observability` · `deploy` ·
`docs`.
8 changes: 8 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Code of Conduct

This project adheres to the Kagenti community Code of Conduct, which is based on the
[Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).

By participating, you are expected to uphold this code. Please report unacceptable
behavior to the maintainers listed in [MAINTAINERS.md](MAINTAINERS.md) or via the process
described in the main [Kagenti](https://github.com/kagenti/kagenti) repository.
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

Thanks for your interest in `lab-context-engineering`, a component of the
[Kagenti](https://github.com/kagenti/kagenti) platform.

## Developer Certificate of Origin (DCO)

All commits must be signed off under the [DCO](https://developercertificate.org/):

```sh
git commit -s -m "feat: ..."
```

This adds a `Signed-off-by:` trailer certifying you wrote or have the right to submit the
patch. PRs with unsigned commits will not be merged.

When a commit was assisted by an AI agent, attribute it with an `Assisted-By:` trailer —
do **not** use `Co-Authored-By` and do not add "Generated with" lines.

## Development

```sh
make fmt # format + go mod tidy
make lint # go vet + gofmt check
make test # go test -race ./...
make build # build ./bin/lab-cx
```

- Go 1.25+.
- Keep packages small and single-purpose; the engine core must stay transport-agnostic.
- Every reduction must be reversible and fail-open. Add tests for both the happy path and
the fault-injection (fail-open) path.

## Pull requests

Use conventional-commit titles (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`).
Keep PRs focused. CI (lint, test, build, Trivy) must be green.

## Reporting security issues

See [SECURITY.md](SECURITY.md). Do not open public issues for vulnerabilities.
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
FROM python:3.13-slim
COPY --from=ghcr.io/astral-sh/uv:0.9.5 /uv /bin/uv
WORKDIR /app
# Build the lab-cx proxy. CGO is required (tree-sitter), so the final image is
# glibc-based (distroless/base), not static.
FROM golang:1.25 AS build
WORKDIR /src
COPY . .
RUN UV_COMPILE_BYTECODE=1 HOME=/tmp uv sync --no-cache --link-mode copy
ENV PRODUCTION_MODE=True
CMD ["/app/.venv/bin/server"]
ARG VERSION=dev
ARG COMMIT=none
RUN CGO_ENABLED=1 go build \
-ldflags "-s -w -X github.com/kagenti/lab-context-engineering/internal/buildinfo.Version=${VERSION} -X github.com/kagenti/lab-context-engineering/internal/buildinfo.Commit=${COMMIT}" \
-o /out/lab-cx ./cmd/proxy

FROM gcr.io/distroless/base-debian12:nonroot
COPY --from=build /out/lab-cx /usr/local/bin/lab-cx
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/lab-cx"]
CMD ["proxy"]
9 changes: 9 additions & 0 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Governance

`lab-context-engineering` is a component of the
[Kagenti](https://github.com/kagenti/kagenti) platform and follows Kagenti's project
governance. See the Kagenti community
[GOVERNANCE](https://github.com/i-am-bee/community/blob/main/GOVERNANCE.md) document for
the roles, decision-making process, and the path to becoming a maintainer.

Maintainers of this repository are listed in [MAINTAINERS.md](MAINTAINERS.md).
Loading
Loading