Skip to content

perf: skip image rebuild when image already exists (fast path for aidc up/claude) - #14

Open
ai-anant wants to merge 1 commit into
cyfinoid:mainfrom
ai-anant:perf/up-fast-path
Open

perf: skip image rebuild when image already exists (fast path for aidc up/claude)#14
ai-anant wants to merge 1 commit into
cyfinoid:mainfrom
ai-anant:perf/up-fast-path

Conversation

@ai-anant

@ai-anant ai-anant commented Aug 2, 2026

Copy link
Copy Markdown

Summary

Every aidc up / aidc claude / aidc codex ran docker compose up -d --build, forcing Docker to re-evaluate — and on any cache miss, re-run — the full ~3 GB image build on every start. This is the "every aidc claude or aidc start results in a large ~4GB container" experience.

This PR adds a fast path: the image is built only when it's missing; otherwise compose just starts the container.

Changes

  • lib/aidc.sh
    • New aidc::image_exists — resolves the compose image name (docker compose config --images) and checks the local image store.
    • New aidc::compose_up — used by cmd_up and ensure_container_running (the path all tool commands go through). Builds only when the image is missing.
    • aidc rebuild / aidc rescan still call compose directly with --build, so forced rebuilds keep working.
    • AIDC_NO_BUILD=1 (project.env or env) opts out of builds entirely: up starts the existing container and fails fast if the image is missing.
  • docs/install.md — documents the fast path and AIDC_NO_BUILD.

Expected impact

  • Second and later aidc up / aidc claude on the same project: near-instant (no build evaluation, no downloads).
  • Build cache stops accumulating re-downloads of agents/scanners per start.
  • First run / after aidc destroy / after aidc rebuild: unchanged (full build).

Test plan

  • bash -n lib/aidc.sh
  • shellcheck -x lib/aidc.sh — clean
  • .github/scripts/bash-compat-check.sh — passes under bash 3.2 (macOS)
  • tests/resolve-oauth-token.test.sh — 7/7 pass
  • Manual: aidc up twice — second run skips the build (verified via compose output)

Closes #13

aidc up / aidc claude & friends always ran 'docker compose up -d --build',
which re-evaluates (and can re-run) the full ~3GB image build on every
start. Add a fast path: build only when the compose image is missing;
otherwise start the container directly. aidc rebuild/rescan still force
--build, and AIDC_NO_BUILD=1 opts out of builds entirely (fails fast if
the image is missing).

Refs cyfinoid#13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Perf: aidc up/claude should skip --build when image is fresh (fast path + pin agents)

1 participant