Skip to content

refactor(core): run engine decomposition + context helpers [v0.3.0 — 1/7]#731

Merged
kokevidaurre merged 5 commits intodevelopfrom
v030/core-refactor
Apr 13, 2026
Merged

refactor(core): run engine decomposition + context helpers [v0.3.0 — 1/7]#731
kokevidaurre merged 5 commits intodevelopfrom
v030/core-refactor

Conversation

@kokevidaurre
Copy link
Copy Markdown
Contributor

Summary — PR 1 of 7 for v0.3.0 release

Core runtime refactoring. Foundation for all subsequent PRs.

Changes (7 files)

  • run-context.ts: expanded context helpers — goal injection, feedback, state loading
  • run-modes.ts: simplified run modes, removed per-squad limits
  • run-types.ts: added conversation_agents field type
  • execution-engine.ts: phase-ordered execution, role-based context
  • agent-runner.ts: bot identity injection, guardrail hooks, tool sets
  • squad-parser.ts: findProjectRoot, skills loading, dynamic discovery
  • env-config.ts: environment URL resolution additions

Merge order

Merge this first. Subsequent PRs build on these changes:

  1. → core-refactor (this PR)
  2. run-engine
  3. conversation
  4. new-commands
  5. init-ux
  6. security-guardrails
  7. tests-docs

Test plan

  • npm run build passes
  • Review refactored modules for correctness

Reorganized from 219-commit develop branch for proper review.
Backup tag: pre-v0.3.0-backup

…er improvements

Core runtime refactoring from v0.3.0 development cycle:

- run-context.ts: expanded context helpers for goal injection, feedback, state
- run-modes.ts: simplified run modes, removed per-squad limits
- run-types.ts: added conversation_agents field type
- execution-engine.ts: phase-ordered execution, role-based context
- agent-runner.ts: bot identity injection, guardrail hooks, tool sets
- squad-parser.ts: findProjectRoot, skills loading, dynamic discovery
- env-config.ts: environment URL resolution additions

Original commits: ~25 from develop (refactors, type fixes, context system updates)
Backup tag: pre-v0.3.0-backup

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements to the agent execution and context management system, including a more robust squad directory discovery mechanism that is git-aware, the ability to inject GCP credentials and guardrail settings into agent sessions, and a reorganized context injection order that prioritizes actionable feedback. It also moves several large prompt blocks (evaluation, lead mode, and verification protocols) into external markdown files for better maintainability. Feedback is provided regarding the hardcoded GCP credential path, the fragile regex-based model resolution from agent frontmatter, and the use of magic numbers in staleness calculations.

Comment thread src/lib/execution-engine.ts Outdated
Comment thread src/lib/execution-engine.ts
Comment thread src/lib/run-context.ts Outdated
Jorge Vidaurre and others added 4 commits April 13, 2026 17:29
…ontmatter, fix staleness calc

- execution-engine.ts: GCP credential path now configurable via
  SQUADS_GCP_CREDENTIALS_DIR env var (was hardcoded ~/.squads/secrets/).
  Use parseAgentFrontmatter() instead of fragile regex for model detection.
- run-context.ts: Replace magic number 86400000 with MS_PER_DAY constant,
  use Math.floor instead of Math.round for staleness calculation.

Co-Authored-By: Claude <noreply@anthropic.com>
Typecheck failed because parseAgentFrontmatter() returns AgentFrontmatter
which didn't include the model property.

Co-Authored-By: Claude <noreply@anthropic.com>
…O, preflightExecutorCheck, pushCognitionSignal, findMemoryDir, timeoutMins

Co-Authored-By: Claude <noreply@anthropic.com>
Cleaned up unused imports and variables flagged by eslint:
- agent-runner.ts: DEFAULT_TIMEOUT_MINUTES, bold, gradient
- scorecard-engine.ts: readFileSync
- org-cycle.ts: logObservability, ObservabilityRecord
- outcomes.ts: prefixed unmergedPRs with _
- repo-enforcement.ts: resolve
- run-context.ts: removed unused readDirMd function + readdirSync
- run-modes.ts: spawn, getProjectRoot, checkLocalCooldown,
  DEFAULT_SCHEDULED_COOLDOWN_MS, saveTranscript, reportExecutionStart,
  reportConversationResult, getBridgeUrl, ora
- run-utils.ts: findMemoryDir
- squad-loop.ts: Squad type

Zero warnings remaining. Zero type errors.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant