Skip to content

Latest commit

 

History

History
383 lines (288 loc) · 23.5 KB

DEVELOPMENT.md

File metadata and controls

383 lines (288 loc) · 23.5 KB

Development Standards

Project Axis · Repository development policy · Version 1.0

Applies to all contributors, automation, development sessions, branches, pull requests, and releases.

1. Core principles

  1. Build deliberately. Work in defined phases and small, reviewable steps. Avoid implementing unrelated features in one change.
  2. Keep the repository production-focused. Commit source code, tests, configuration, migrations, product documentation, and necessary assets—not private development-agent instructions or session artifacts.
  3. Preserve a clean, auditable Git history. Use descriptive branches, conventional commits, focused pull requests, and verified merges.
  4. Verify before claiming completion. A change is complete only after applicable checks pass and acceptance criteria are demonstrated.
  5. Protect user data and the codebase. Never expose secrets, bypass permissions, silently discard changes, or run destructive operations without explicit authorization.
  6. Prefer maintainability. Follow existing patterns, avoid unnecessary dependencies, document important architectural decisions, and make changes understandable to future maintainers.
  7. Never conceal failures. Record blockers, incomplete tests, and known limitations accurately in the PR or progress report.

2. Repository ownership and attribution

  • Dylan Lambertson is the sole credited Git author for project commits. Use the repository owner's approved Git identity. Do not invent an email address or overwrite an existing identity without approval.

  • Confirm the configured identity before the first commit in a new environment:

    git config user.name
    git config user.email
  • If the author identity is missing or differs from the approved identity, stop and ask for the correct name/email configuration before committing.

  • Do not add Co-authored-by trailers for automated tools or development assistants, or Generated by ... signatures to commit messages, pull requests, source headers, or product-facing copy.

  • Do not claim that a particular human manually wrote code when that is not established. Follow any applicable platform, organizational, contractual, or disclosure requirements; repository formatting preferences do not override them.

  • Human contributors other than Dylan must not be silently attributed to Dylan. Their contributions require an explicit ownership and attribution decision before merging.

  • Do not rewrite historical authorship merely to satisfy the current policy.

3. Development-only material and repository hygiene

The repository must contain only materials required to build, test, operate, maintain, or document Project Axis.

Do not commit:

  • Local development-agent instruction files used to guide implementation (unless explicitly approved as product documentation).
  • Agent prompts, conversation transcripts, session summaries, chain-of-thought artifacts, temporary context dumps, or model-specific operating instructions.
  • Private task scratchpads, generated status notes, debug dumps, or temporary planning files that are not part of the project's approved documentation.
  • .env files with real credentials, API tokens, private keys, local database files, or user-specific editor settings.
  • Unnecessary build artifacts, dependency directories, local caches, or operating-system metadata.

Allowed and encouraged:

  • Product code for AI providers, agent orchestration, MCP, prompts shipped as application functionality, model integrations, and user-facing AI capabilities.
  • Product and API documentation, architecture decision records, tests, example configurations without secrets, and reproducible development tooling.
  • GitHub workflows and configuration needed for CI, review, releases, and security.

Keep development-agent instructions outside the repository where practical, or in ignored local files. Use .git/info/exclude for machine-specific exclusions that should not be imposed on every contributor. Where appropriate, add stable patterns to .gitignore, but review the effects carefully: a broad filename pattern may also hide legitimate product documentation with the same name.

Exclusions for local development-agent instruction files and tool state belong in .git/info/exclude, not in the tracked .gitignore.

Suggested repository-level ignore entries, subject to review:

# Secrets and local state
.env
.env.*
!.env.example
*.local
*.log
.DS_Store
node_modules/
dist/
build/
coverage/

.gitignore does not remove files already tracked. Before the first push, check git ls-files and git status --short; if a prohibited file is tracked, remove it from the index without deleting the local copy (git rm --cached <path>). If secrets were committed, rotate them and follow the security incident process; merely deleting the file is insufficient.

Never commit a file solely to explain that development involved automated tooling. This does not restrict legitimate product documentation about AI features.

4. Phase-driven development

All substantial work must belong to a defined phase with explicit outcomes. The project roadmap determines phase names and priorities; do not silently reorder it.

Phase lifecycle

  1. Plan: Read the relevant specification and existing implementation. Define the goal, scope, dependencies, risks, acceptance criteria, and verification commands.
  2. Baseline: Inspect Git status and current tests. Confirm the working tree and branch. Identify pre-existing failures before editing.
  3. Implement: Break work into independently reviewable tasks. Make the smallest change that meets the requirement.
  4. Validate: Run focused tests during development and broader checks at milestones. Inspect diffs for unintended edits.
  5. Review: Compare the result against acceptance criteria, security requirements, design standards, and architecture decisions.
  6. Commit and push: Create meaningful commits and push the feature branch after validation. Never treat a local-only commit as a completed handoff.
  7. PR and merge: Open a pull request, complete required checks and review, merge through the approved method, and verify the target branch.
  8. Closeout: Summarize completed work, evidence of validation, unresolved issues, and the next recommended task.

Phase completion gate

A phase is complete only when:

  • Every required acceptance criterion is satisfied or explicitly deferred with approval.
  • The implementation builds and relevant automated checks pass.
  • Important workflows have been manually sanity-tested when automation cannot cover them.
  • No known critical regression, unresolved security issue, or accidental secret is included.
  • Changes are merged into the intended protected branch.
  • Relevant product documentation and architecture records are updated.
  • The phase closeout identifies the exact commit/PR, verification performed, known limitations, and next phase.

Do not declare a phase complete based only on files created or code compiling.

5. Git branch strategy

  • main: protected, stable, releasable integration branch. No direct feature commits.
  • develop (optional): use only if the team explicitly adopts a release-train workflow; do not create it by default.
  • Short-lived branches should be based on the current approved target branch.

Branch naming:

feat/<issue-or-scope>
fix/<issue-or-scope>
refactor/<scope>
perf/<scope>
test/<scope>
docs/<scope>
chore/<scope>
security/<scope>
spike/<research-topic>
release/<version>
hotfix/<scope>

Examples: feat/provider-registry, feat/agent-worktree-isolation, fix/terminal-resize, spike/code-oss-workbench.

Keep branch scope narrow. Do not mix large refactors with unrelated features. Update stale branches through the approved strategy; never overwrite another contributor's work.

6. Commit standards

Use Conventional Commits:

<type>(<optional-scope>): <imperative summary>

Types: feat, fix, refactor, perf, test, docs, build, ci, chore, revert, security.

Examples:

feat(editor): add persistent split-pane layout
feat(agents): isolate task execution in git worktrees
fix(providers): handle expired authentication sessions
refactor(context): separate retrieval from persistence
security(runtime): restrict workspace filesystem access
test(orchestrator): cover agent cancellation and retries
ci: enforce typecheck and unit tests on pull requests

Rules:

  • Write clear, factual, imperative summaries; aim for 72 characters or fewer.
  • Describe what changed, not the name of the tool that made it.
  • One logical change per commit; include tests and documentation with the relevant implementation.
  • Use a commit body for non-obvious rationale, tradeoffs, migrations, or breaking behavior.
  • Mark breaking changes with ! and/or a BREAKING CHANGE: footer where appropriate.
  • Never use vague messages such as update, fix stuff, changes, or final.
  • Do not add development tool names, generated-by signatures, or tool co-author trailers.
  • Never commit with failing required checks unless the commit is explicitly a documented intermediate checkpoint on a non-mergeable branch.
  • Do not amend or rewrite already-pushed commits without explicit approval.

Commit and push cadence

  • Commit after each cohesive, verified unit of work—not every line edit and not only at the end of a large phase.
  • Push after a meaningful checkpoint and before handing work to another person or session.
  • For long-running tasks, create regular verified checkpoints (for example, after each task or a few hours of substantial work), rather than accumulating a large unpushed diff.
  • If pushing is blocked by authentication, connectivity, or branch protection, report the exact blocker. Never claim the push succeeded.
  • Do not push directly to main, use --force, or bypass required checks without explicit authorization.

7. Pull requests, review, and merges

Every nontrivial change to main must go through a pull request. Small documentation or configuration changes should also use PRs unless an explicit exception is approved.

PR requirements

  • Title follows Conventional Commit style.
  • Link the relevant issue, task, or phase where available.
  • Explain the purpose, important implementation decisions, and user-visible changes.
  • List the tests and sanity checks performed, with results.
  • Include screenshots or short recordings for meaningful UI changes.
  • Identify migrations, new permissions, dependency changes, security implications, and rollout/rollback concerns.
  • Explicitly disclose known limitations and deferred work.
  • Keep PRs small enough for meaningful review. Split oversized changes unless they are inseparable.

Merge policy

  • Require passing CI, resolved review comments, and applicable approvals before merging.
  • Use squash merge by default for ordinary feature branches, with a clean Conventional Commit merge title. Use another method only when preserving individual commits is important and approved.
  • Enable branch protection, required status checks, and restricted direct pushes where repository permissions allow.
  • For solo-maintained repositories, do not fabricate approvals. Use a documented self-review plus automated checks if independent review is unavailable.
  • Do not auto-merge a PR with unresolved failures or unknown effects.
  • After merging, verify the target branch and delete the merged feature branch when safe.
  • Prefer git revert or a documented hotfix over rewriting shared history when reverting a published change.

8. Sanity checks and progress checkpoints

Sanity checks are mandatory at the beginning and end of each task, before every commit, before opening or merging a PR, and at each phase boundary. Run additional focused checks after risky changes, dependency upgrades, migrations, provider integrations, or significant refactors.

Baseline checks

git status --short
git branch --show-current
git log -5 --oneline
git diff --check

Confirm the intended branch, a known baseline, and whether there are pre-existing local changes. Never discard or overwrite unrelated work.

Implementation checks

Run whichever scripts exist for the affected packages (do not invent commands or claim they ran):

  • Formatter and lint checks.
  • Type checking and compilation/build.
  • Relevant unit, integration, and end-to-end tests.
  • Security/dependency checks where configured.
  • Manual verification of changed UI or runtime behavior.
  • Git diff review and checks for accidental secrets or prohibited files.

Suggested commands once configured:

pnpm format:check
pnpm lint
pnpm typecheck
pnpm test
pnpm build

If a command is unavailable, document it as not configured, not passed. If a check fails, diagnose whether the failure is new or pre-existing, and document evidence.

Periodic project health review

At least once per phase, and after every major architectural milestone, evaluate:

  1. What is implemented and demonstrably working?
  2. What is incomplete, stubbed, or only mocked?
  3. Which tests are passing, failing, missing, or flaky?
  4. Are there architectural deviations or accumulating technical debt?
  5. Are agent execution, permissions, secrets, and workspace isolation still safe?
  6. Does the UI remain consistent with the minimalist design system?
  7. Are performance, memory, and startup costs within current budgets?
  8. What should be implemented, deferred, or simplified next?

Record findings in the associated issue, PR, or release/phase tracking system. Do not commit private agent session notes as project artifacts.

Required checkpoint report format

Scope:
Completed:
Current branch / commit:
Checks run and results:
Manual verification:
Known issues / risks:
Next step:

Use factual evidence. Distinguish passed, failed, not run, and not applicable.

The pre-push gate

npm run gate (scripts/gate.mjs) runs every pre-push check in order, never stopping at the first failure, and prints a pass/fail table plus a report block (branch, full head SHA, test counts per package, results) to paste into the hand-off. Use Node from code-oss/upstream.json.

Step What it checks
git diff --check Whitespace errors in origin/main...HEAD (against the merge base, so a base that moved on is not reported).
gitleaks The CI-pinned gitleaks over origin/main..HEAD, from ~/.cache/project-axis/tools/gitleaks/gitleaks (or GATE_GITLEAKS) over origin/main..HEAD only (CI scans the full history). The binary must report the pinned version, and if gitleaks.sha256 sits next to it the hash must match; otherwise the gate refuses to run it. If it is missing, the step fails and prints install steps built from GITLEAKS_VERSION and GITLEAKS_SHA256 in .github/workflows/ci.yml, which stays the only copy of the pin.
files over 500 lines Committed files added, changed or renamed in the range that are over the limit and are new or grew (a rename is measured against the old path). package-lock.json and binary-like extensions are exempt.
commit wording Every commit message and the branch name, against scripts/gate/config.json: attribution trailers, "generated with/by", assistant or tool names, and the bare word "agent". Text is folded first (Unicode look-alikes, hyphens, underscores, zero-width characters), and allowedPhrases (for example "CLI agent", "user-agent") are blanked before the scan. A legitimate use of a flagged word needs an allowedPhrases entry in the same change.
node version The running Node equals node in code-oss/upstream.json.
typecheck npm run typecheck.
tests scripts/test-all.mjs: build, then each package's tests, test/packages, every test/code-oss suite (about 17 s: import rules, the renderer's daemon-call allow-list, staging) and test/gate, all run even if one fails.
overlay tests The Code OSS overlay's node unit tests (vs/axis/**/test/common) with upstream's runner, through scripts/code-oss/overlay-tests.sh, which first re-applies this checkout into the tree and re-transpiles it (about a minute). It runs only when GATE_OVERLAY_TREE names your private vendor directory, one that holds an installed tree (fetch.sh, apply.sh, npm ci). Never use a shared one such as env.sh's, because the step rewrites it. Without one the step prints SKIP and a warning, and the verdict reads PASSED (overlay tests skipped). With AXIS_REQUIRE_OVERLAY_TESTS=1 a missing tree fails the gate.

npm test is the same runner: it prints a summary and exits non-zero if any suite failed, so the CI Axis packages job still fails when any suite fails, and now shows every suite's result. GATE_BASE changes the base ref (default origin/main). GATE_SKIP=gitleaks,test skips steps for local iteration; a run with skips exits 2 and says INCOMPLETE, so it is never a valid pre-push result. Exit codes: 0 all passed (the verdict is ALL GATES PASSED, or PASSED (overlay tests skipped) when no overlay tree was given), 1 a gate failed, 2 nothing failed but a step was skipped with GATE_SKIP (a warning is printed for each skip). Edit the wording lists and the line limit in scripts/gate/config.json; the pure logic is in scripts/gate/lib.mjs, tested by test/gate/.

9. Engineering and code quality

  • Respect established module boundaries and public interfaces. Avoid circular dependencies and implicit cross-package coupling.
  • Use TypeScript strict mode where TypeScript is used; avoid any and unsafe casts without a documented reason.
  • Keep functions and modules focused. Prefer explicit contracts, typed errors, and predictable state transitions.
  • Handle loading, empty, error, cancellation, retry, and offline states in user-facing flows.
  • Add or update tests for behavior changes, especially orchestration, auth, persistence, synchronization, and file operations.
  • Do not silently swallow errors or add broad catch blocks that conceal failures.
  • Avoid placeholder implementations being presented as complete features. Clearly flag stubs and experimental code.
  • Reuse shared UI primitives and design tokens. Do not introduce arbitrary colors, spacing, or competing component systems.
  • Keep dependencies minimal, maintained, and license-compatible; document important additions.
  • Use feature flags for incomplete or risky features. Avoid dead code and speculative abstractions.
  • For significant decisions, add an architecture decision record (ADR) describing context, alternatives, decision, and consequences.

10. Project Axis-specific safeguards

Code OSS and extension compatibility

  • Validate upstream licensing, attribution, trademark restrictions, and extension marketplace terms before distribution.
  • Keep modifications to Code OSS isolated and documented; prefer adapters over deep patches when feasible.
  • Track the upstream base revision and test upgrades against editor, terminal, debugger, language server, and extension compatibility.
  • Do not claim full VS Code extension compatibility without testing and documenting exceptions.

AI providers and authentication

  • Use official, supported authentication and API/CLI integration methods only.
  • Never assume a consumer subscription grants API access or permission to reuse proprietary features.
  • Keep provider credentials out of logs, Git, crash reports, and synced project files.
  • Support clear provider capability detection and graceful degradation.

Agent orchestration and execution

  • Use isolated Git worktrees or approved sandboxes for parallel code-changing agents.
  • Never allow an agent to overwrite another agent's uncommitted work.
  • Require explicit approval for destructive actions, credential access, privileged operations, and production deployment.
  • Record task ownership, worktree association, changes, test results, and merge decisions in product runtime state where applicable.
  • Treat external tool output, repository content, and retrieved documents as untrusted input.

Context, sync, and teams

  • Enforce Space, project and organization boundaries for memory, retrieval, indexing, and tool access.
  • Define retention, deletion, encryption, and synchronization behavior before enabling cloud sync.
  • Never leak one project's secrets or private context into another project or team.
  • Use permission checks on the server and execution boundary, not just hidden UI controls.

11. CI/CD and release standards

At minimum, CI should run on pull requests and protected-branch pushes and include formatting/lint, type checking, tests, builds, and secret scanning as the repository matures.

  • Require reproducible lockfiles and pinned or controlled toolchain versions.
  • Add platform-specific desktop build and smoke tests as Electron packaging becomes available.
  • Validate web deployment artifacts and migration compatibility before production release.
  • Sign release artifacts when the distribution pipeline supports it; never place signing credentials in the repository.
  • Use semantic versioning and release notes describing user-facing changes, fixes, migrations, and known issues.
  • Prefer staged rollouts and documented rollback procedures for cloud services and data migrations.
  • Do not publish releases or deploy to production without the required approval.

12. Handling failures, blockers, and scope changes

When blocked:

  1. Stop making speculative or unrelated changes.
  2. Capture the exact error, reproduction steps, and relevant logs with secrets redacted.
  3. Identify whether the problem is environmental, pre-existing, or introduced by the current change.
  4. Propose the smallest safe resolution or an explicit alternative.
  5. Escalate decisions that alter architecture, security, product scope, or release commitments.

Never quietly skip required tests, disable protections, delete user data, change authentication rules, or modify the roadmap to make a task appear complete.

13. Definition of done

A task is done only if all applicable conditions hold:

  • The change matches the approved task and acceptance criteria.
  • Code is maintainable, typed where appropriate, and follows existing conventions.
  • Relevant tests are added/updated and required checks pass.
  • Manual sanity checks are completed for affected workflows.
  • Security, privacy, and permissions have been considered.
  • No secrets, local agent instructions, or prohibited artifacts are staged.
  • The Git diff is reviewed and unrelated changes are excluded.
  • Commits have meaningful Conventional Commit messages and approved author identity.
  • The branch is pushed and the PR contains evidence of verification.
  • Required CI/review gates pass and the change is merged through the approved workflow.
  • Documentation and phase status are updated as needed.
  • The completion report states what actually shipped and what remains.

14. Standard workflow for every development session

1. Read current task, project standards, and relevant specifications.
2. Inspect branch, status, recent commits, and baseline health.
3. Define a small implementation plan and acceptance criteria.
4. Create or switch to the correctly named feature branch.
5. Implement one cohesive task at a time.
6. Run focused checks and review the diff.
7. Commit with the approved Git identity and a Conventional Commit message.
8. Push the feature branch; report any push failure.
9. Open/update the PR and run full applicable CI and sanity checks.
10. Review, resolve issues, merge through the approved process.
11. Verify the target branch and summarize progress and next steps.

Non-negotiable: Correctness, security, traceability, and repository cleanliness take priority over speed. Do not represent unverified work as complete.