Skip to content

Autoresearch director project integration #670

Description

@jeonghun-jj-lee

Autoresearch director project integration

Part of #663. Blocked by #665 and #666 (needs project.toml on disk and type detection to identify project-bound sessions).

Important

Problem: The autoresearch director, its mode card, and the director-core skill all hardcode vault paths — session ledgers in <personal vault>/sessions/, hypotheses in <vault>/hypotheses/, specs in <vault>/specs/. When a session is bound to a research project, the director has no way to read or write the project's ledger/, scripts/, data/, or config/ directories.

Approach: Introduce a conditional path model: when the context includes an Active Research Project (injected by stack_state.ts from project.toml), the director reads/writes the project directory. When no project is bound, existing vault behavior is unchanged. Update the LEDGER DISCOVERY RULE to v2 (project-aware), update the autoresearch skill with conditional path rules, and update the context plugin to inject project metadata.

Scope: 7 files across skills, mode card, context plugin, and onset router. No changes to the gate pack, core clauses, role definitions, or loop structure.

Acceptance Criteria

Director-core (LEDGER DISCOVERY RULE v2):

  • director-core/SKILL.md updated: LEDGER DISCOVERY RULE carries a project-aware conditional — when project-bound, ledger path is <project>/ledger/campaigns/campaign-<YYYYMMDD>-<slug>.md; when not, existing <personal vault>/sessions/session-<YYYYMMDD>-<slug>.md
  • The canonical block remains self-contained and embeddable by mode cards

Autoresearch skill (project-aware context assembly):

  • autoresearch/SKILL.md updated: when operating on a research project, reads hypotheses from <project>/ledger/hypotheses/, writes campaign ledgers to <project>/ledger/campaigns/, writes observations to <project>/ledger/observations/, reads scripts from <project>/scripts/, reads data from <project>/data/, reads config from <project>/config/
  • vault_contract frontmatter supplemented with project_contract (folders: ledger/{hypotheses,observations,campaigns}, scripts/, data/, config/)
  • Vault fallback: when no project is bound, all existing vault paths unchanged (no regression)
  • Checkout registry (sessions/CHECKOUTS.md) stays vault-based (fleet-wide, not project-scoped)

Mode card:

  • agents/autoresearch.md re-embeds the updated DIRECTOR-SPINE block (v2 ledger rule) between the existing markers

Context plugin (project injection):

  • stack_state.ts detects the session's project binding (workspace folder with project.toml)
  • When project-bound, injects an ## Active Research Project block into the system prompt: project name, question, status, directory path, and layout summary
  • When not project-bound, existing context injection unchanged

Supporting skills:

  • hypothesis-review/SKILL.md updated: when project-bound, reads hypotheses from <project>/ledger/hypotheses/
  • Onset router (AGENTS.md + router.ts): "Resume the active campaign" checks <project>/ledger/campaigns/ when project-bound, vault sessions/ otherwise

Invariants preserved:

  • The four core clauses unchanged (ledger discipline, cast pattern, compaction honesty, anti-gaming)
  • The gate pack (research.toml) unchanged — it references concepts, not paths
  • The loop structure (plan → dispatch → analyze → record) unchanged
  • Role definitions (hypothesizer/experimenter/analyzer) unchanged
  • Fleet-wide checkout registry stays vault-based

Testing Decisions

  • Manual smoke test: bind a session to a research project, invoke autoresearch, verify director reads <project>/ledger/hypotheses/ and writes campaign ledger to <project>/ledger/campaigns/
  • Manual regression test: session not bound to a project, verify director uses vault paths as before
  • Unit test for stack_state.ts: project-bound session → "Active Research Project" block in context; non-project session → no block

Key Decisions

Decision Rationale
Conditional paths (project vs vault), not hard switch Backward compatible; vault-only users unaffected
Context plugin injects project metadata, skill carries path rules Separation of concerns: plugin says "where," skill says "what"
Checkout registry stays vault-based It's fleet-wide coordination, not project-scoped
LEDGER DISCOVERY RULE v2 (not v1 replacement) Mode cards embed this block verbatim; versioning makes the change explicit

Files modified

# File Repo Type of change
1 skills/director-core/SKILL.md harmoniqs/armonissima (team vault, separate repo) — requires a PR to armonissima, merged before this issue can land LEDGER DISCOVERY RULE v2
2 packages/extension/skills/autoresearch/SKILL.md amicode Conditional project/vault path rules, project_contract
3 packages/extension/agents/autoresearch.md amicode Re-embed updated DIRECTOR-SPINE
4 packages/extension/opencode-plugin/stack_state.ts amicode Project context injection (uses detectProjectType from #666)
5 packages/extension/skills/hypothesis-review/SKILL.md amicode Project-aware hypothesis reading
6 packages/extension/AGENTS.md amicode Onset router: project-aware campaign resume
7 packages/extension/src/scores/router.ts amicode Campaign resume checks project ledger

Note on director-core/SKILL.md: This skill's canonical copy lives in the harmoniqs/armonissima repo (the team vault), mounted read-only at ~/.amico/vaults/armonissima/skills/director-core/. The runtime copy at opencode-project/skills/director-core/ is staged from armonissima. To update it, submit a PR to harmoniqs/armonissima first, then the staged copy will pick up the change on next skill resolution.

Constraints & Invariants

  • The protocol (loop, clauses, gates, roles) is path-agnostic and unchanged
  • The conditional path model is "project when bound, vault otherwise" — never both simultaneously for the same artifact
  • The checkout registry is the sole exception: always vault-based (fleet-wide coordination)
  • A project-bound campaign that runs without a vault must work (standalone-first)

Source

Part of #663. Blocked by #665 and #666. Cross-repo: requires a PR to harmoniqs/armonissima for the director-core/SKILL.md update.

Activity

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

Metadata

Metadata

Labels

hitlHuman in the loop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions