CODI Container Dietitian

Offline-first container optimization

Smaller images. Zero data egress.

CODI analyzes your Dockerfiles, rewrites them with vetted stack-aware templates, and hands you a signed-off audit trail for every change — running entirely inside your own network.

MIT licensed · Python 3.12 · Node, Python & Java stacks

demo/node · Dockerfile

Before

320 MB

18 layers

FROM node:20
WORKDIR /app
COPY . .
RUN npm install
RUN apt-get update
USER root
CMD npm start

After −35.9%

205 MB

12 layers

FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
FROM node:20-slim
USER codi
CMD ["node","server.js"]

Dry-run estimate from a sample run · results vary by project

≥30% Target image size reduction
≥3 Fewer layers per rewrite
<10s Full analyze → report pass
0 Bytes sent off your network

The problem

Container bloat is expensive. Sending code to a vendor is worse.

Most teams know their images are too big — bloated base layers, dev dependencies shipped to production, secrets sitting in the build context. The tools that fix it well tend to want your Dockerfile on somebody else's server. If you work under a compliance regime, that's a non-starter.

Deterministic, not generative

Rewrites come from a reviewed template catalog, so the same input always produces the same output. Nothing invents a Dockerfile instruction that wasn't vetted first.

Rules catalog

Every change is explained

Each run writes a Markdown and HTML report with diffs, policy notes, projected metrics, and the rationale for every substitution — ready to hand to a reviewer.

Reporting

Offline is the default

Air-gap mode is on out of the box. Outbound HTTP is blocked at the client layer, and only hosts you explicitly allowlist can ever be reached.

Security model

Fits your pipeline

Identical capability through the codi CLI and a FastAPI service, so a laptop, a CI job, and an internal portal all behave the same way.

API guide

How it works

Four stages, fully reproducible

One command runs the whole pipeline and stores every input, candidate, metric, and log under a timestamped run directory you can diff, archive, or audit later.

Analyze & detect

A tolerant parser reads the Dockerfile, detects the application stack, and flags quality and security smells.

Parser · stack detector

Rewrite & render

Jinja2 templates from the rules catalog generate optimized candidates, with rationale comments inline.

rules.yml · templates

Estimate & store

A dry-run estimator projects size, layer, and timing changes, then persists the artifacts for the run.

metrics.json · run store

Rank & explain

Optional: a local LLM ranks the candidates and drafts human-readable rationales without any network call.

Optional · on-host

Built for regulated environments

Your Dockerfiles never leave the building

CODI was designed for teams who cannot send source artifacts to a third party — defense, finance, healthcare, and anyone running a disconnected data center.

  • Air-gap enforced by default. AIRGAP=true blocks outbound HTTP; unapproved hosts raise an error rather than failing open.
  • Explicit allowlists. Exact hostnames only via AIRGAP_ALLOWLIST — no wildcards.
  • Non-root containers. Both images run as the unprivileged codi user.
  • The model runs on your hardware. LLM assist is a local llama.cpp server; raw Dockerfile content is never emitted in a prompt payload that leaves the host.
  • Provenance you can audit. Inputs, outputs, metrics, and environment metadata are captured for every run.
$ codi run ./checkout-service

 stack detected      node / next
 smells found        4 (1 high, 3 medium)
! runs as root — hardening applied

 candidates rendered 3
 size  320 MB  205 MB   -35.9%
 layers     18  12       -6

network      blocked (AIRGAP=true)
artifacts    runs/20260916T1412Z-node/
report       runs/.../reports/report.html

done in 0.65s

Two deployment footprints

Pick the one that matches your environment

Both ship as containers and expose the same CLI and API. Start with Slim in CI; add Complete where you want written rationales without a cloud dependency.

Rules only

codi:slim

The deterministic engine on its own. Small, fast, and predictable — the right fit for CI pipelines and disconnected stages.

  • Rules catalog and template rendering
  • Metrics, diffs, and full reports
  • No model weights, no LLM runtime
  • Outbound network blocked
Slim container guide

Get started

Running in about two minutes

CODI is open source under the MIT license. Clone it, set up the environment, and point it at a project — the first run works offline with no configuration and no account.

  • Python 3.12 and Make
  • Docker 24+ with BuildKit, for the container workflows
  • No API keys, no sign-up, no telemetry
# 1 — clone
$ git clone https://github.com/KiniunCorp/codi.git
$ cd codi

# 2 — set up the environment
$ make setup
$ source .venv/bin/activate

# 3 — optimize and report
$ codi all ./my-service

 report written to
  runs/<timestamp>/reports/report.html

See it in action

Two short walkthroughs

A tour of the pipeline end to end, and a closer look at how the optional local model fits in.

Platform overview

1:51

The local LLM module

1:08

Documentation

Everything is written down

Architecture, the rules catalog, the security model, the API contract, and the LLM internals — all documented, all public.

Start here

What CODI does, how to install it, and a cheat sheet for the commands you'll use daily.

Overview

Architecture

Module-by-module design, the technology stack, and the supported deployment models.

System design

Operate it

Day-two runbooks, the security posture, performance budgets, and the reporting artifacts.

Operations

Extend it

Add rules, support a new stack, or train and mount your own adapter for the local model.

Rules & templates

Part of KiniunCorp

One toolkit in a set of three

CODI is built by KiniunCorp, which makes tools for structured, reliable AI-driven engineering. The through line across all three: determinism over cleverness, evidence instead of claims, and a human holding the approvals.

Workflow

Spec-To-Ship

A lightweight process layer around your existing AI chat client — stages, approval gates, and persistent state, so work that needs design doesn't get coded first.

spec-to-ship.com
Verification

Bramo

An agentic software factory, managed by a human. Its bramo-verify CLI audits a git diff and reports what it observed — never what an agent claimed.

bramo.ai

Get in touch

Evaluating CODI for your organization?

We work with teams putting CODI into regulated and disconnected environments — air-gapped deployments, custom rule catalogs, and adapters tuned to your own base images. Tell us what you're building and we'll get back to you.

Open source under MIT · built by KiniunCorp