Skip to content

crocoder-dev/shared-context-engineering

Repository files navigation

Shared Context Engineering (SCE)

crates.io npm Nix CI

AI made code generation fast. Team alignment didn't keep up.

SCE treats the why behind your code, architecture, decisions, constraints, as a versioned, shared artifact that both your team and your AI agents work from.

  • a repo-owned context/ directory holding the architecture, decisions, and constraints AI agents otherwise re-derive every session
  • generated configs that make OpenCode and Claude Code actually read it
  • a Bash policy that keeps agents inside your repo's rules
  • hooks that capture agent activity at the commit boundary
  • a local Agent Trace SQLite database linking each commit to the session that produced it

Quick start

Install the sce CLI through whichever channel fits your environment:

# npm
npm install -g @crocoder-dev/sce

# cargo
cargo install shared-context-engineering --locked

# nix
nix profile install github:crocoder-dev/shared-context-engineering

Then, from inside a git repository:

sce setup     # install generated assistant config, hooks, and bash policy
sce doctor    # verify the install is healthy

sce setup writes the OpenCode and/or Claude config into your repo, installs the required git hooks, and initializes the per-repo Agent Trace database. sce doctor is read-only by default; sce doctor --fix will repair the issues it knows how to repair (missing or stale hooks, missing canonical DB parent directories) and report the rest for manual follow-up.

Bash policy

Stop agents from running commands your repo does not allow.

Configure policies.bash in .sce/config.json with built-in presets and/or your own deny rules. Examples of what teams use it for:

  • block direct git commit so agents go through the SCE commit flow
  • prevent package-manager drift (e.g. block npm/pnpm in a Bun repo)
  • enforce any custom repo rule expressible as a command-prefix match

Agent Trace

SCE writes a local, per-repo audit trail conforming to the Agent Trace spec. Each commit links back to the agent conversation, tool calls, and diff that produced it, all stored on your machine.

Supported integrations

Feature OpenCode Claude Code
Generated config
Hooks + Bash policy
Conversation + diff trace
Model / session attribution full full
Shared context/

OpenCode and Claude Code are first-class. Other agents can read context/ but don't get generated config, hooks, or Bash policy enforcement.

Why this exists

AI sped up code generation, not team alignment. Without shared, durable context, every agent session starts cold and every reviewer re-derives the why from scratch, what we call cognitive debt. SCE is the infrastructure to pay it down.

Read the full argument → Motivation

Documentation


Built by CroCoder.