Passa al contenuto principale

ARSGATE Universal Context Persistence & Resume Contract

Status: Implemented governance baseline
Owner: Project Bootstrap
Scope: Every current and future ARSGATE component

Permanent behavior​

Once Project Bootstrap validates a component, later automation reuses persisted context instead of repeating global Redmine/Forgejo discovery.

Full discovery is permitted only when context is missing/stale, explicitly invalidated, conflicting, or a first-time resource creation/reconciliation is still incomplete.

A conflict is CONFLICT_STOP. Missing local state never authorizes invention of a repository, worktree, branch, Redmine project, issue mapping, Forgejo owner, or secret path.

Authority​

Versioned static authority remains in Project Bootstrap manifests and registry/arsgate-resource-registry.yaml.

Dynamic validated execution state is protected outside Git:

/srv/services-node/state/project-bootstrap/context-state.yaml

Audit events are appended to:

/srv/services-node/state/project-bootstrap/context-audit.jsonl

Repository safety​

Local repository paths are persisted only when exactly one existing local repository root matches the expected Forgejo remote.

  • one match: VERIFIED;
  • no match: UNBOUND;
  • multiple matches: CONFLICT_STOP.

UNBOUND means stop before filesystem Git work. It never means create another clone.

Worktree and branch safety​

The context engine inventories existing Git worktrees. An implementation worktree may be bound only when that exact worktree already exists, belongs to the canonical repository, and is on a named branch. Multiple matching worktrees are a conflict. No replacement worktree is invented.

Redmine continuity​

Successful full discovery persists the canonical project and logical-key -> Redmine issue-ID map. If canonical logical keys later change, the context becomes stale and exactly one authoritative reconciliation is required before fast reuse resumes.

Resume checkpoints​

After an implementation worktree is explicitly bound, a checkpoint records component, issue, worktree, branch, commit, timestamp and continuation note. This provides machine-readable resume state independent of chat memory.

Mandatory Runtime Target Gate​

A validated repository/worktree context does not prove which live runtime serves a URL or operation. Before any runtime-specific code change, restart, recreate, deployment, migration, or live test, automation must verify the exact request path against the runtime that currently answers it.

The verification is fail-closed and must bind at least the exact URL/path, runtime identity, environment, and source commit where applicable. Static compose names, repository paths, environment labels, previous chats, previous deployments, or nearby routes are not sufficient evidence.

A mismatch, missing identity, stale commit, ambiguous proxy route, or inability to probe is CONFLICT_STOP before mutation. The gate must run again after deployment; if post-deploy identity or provenance does not match, the change is not considered deployed.

For Control Center DEV, the canonical verifier is /srv/services-node/arsgate-dev-environments/scripts/verify-runtime-target.sh. Runtime-specific work must not bypass this gate merely because multiple containers mount the same source tree.

Mandatory downstream rule​

Every ARSGATE automation touching Git, Redmine or Forgejo must resolve context first. Normal work uses the persisted fast gate. Full discovery is fallback, not the default workflow.