Skip to content

feat(onboarding): add links stage + bridge onboarding to profile.json - #513

Merged
jeonghun-jj-lee merged 15 commits into
mainfrom
profile-onboarding-bridge
Aug 23, 2026
Merged

feat(onboarding): add links stage + bridge onboarding to profile.json#513
jeonghun-jj-lee merged 15 commits into
mainfrom
profile-onboarding-bridge

Conversation

@jeonghun-jj-lee

@jeonghun-jj-lee jeonghun-jj-lee commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Part of harmoniqs/opencode#231

Bridges onboarding data into ~/.amico/profile.json so the new profile dropdown popover (opencode PR #234) is populated immediately after onboarding completes.

Changes

  • ENTITY_FIELDS expandeddescription, research_area, experiment_kind, scholar, github, custom_link_url, custom_link_label no longer silently dropped by sanitizePayload
  • Links stage — new optional stage in the overture asking for Scholar, GitHub, and custom link URLs
  • materializeProfileJson() — on onboarding_completed, replays events stream and writes identity fields to profile.json (additive merge, never clobbers inline edits)
  • Tool description updated — documents all accepted profile fields

Summary by CodeRabbit

  • New Features

    • Added guided pulse-design workflow covering platform selection, modeling, targets, solving, and result review.
    • Onboarding now collects research and profile details, including affiliations and links.
    • Completed onboarding information is saved to the local profile for future sessions.
    • Added editable pre-filled values for text questions.
  • Improvements

    • Improved onboarding resume and completion detection.
    • Updated routing so pulse design and user-provided problems start the appropriate workflow directly.
    • Expanded profile documentation and supported fields.

@jeonghun-jj-lee jeonghun-jj-lee added the hitl Human-in-the-loop — needs human review/decision label Aug 23, 2026
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d7d3fe9e-c9f9-4c1d-a305-5676a5a07fab

📥 Commits

Reviewing files that changed from the base of the PR and between 5011b9b and 16a8afe.

⛔ Files ignored due to path filters (1)
  • packages/app-bundle/overlay/packages/sdk/js/src/v2/gen/types.gen.ts is excluded by !**/gen/**
📒 Files selected for processing (18)
  • packages/app-bundle/overlay/packages/app/src/pages/session/composer/session-question-dock.tsx
  • packages/app-bundle/overlay/packages/schema/src/question.ts
  • packages/app-bundle/overlay/packages/schema/src/v1/question.ts
  • packages/extension/opencode-plugin/amicode_tools.ts
  • packages/extension/opencode-plugin/onboarding.ts
  • packages/extension/scores/overture/SCORE.md
  • packages/extension/skills/design-a-pulse/SKILL.md
  • packages/extension/src/opencode_config.ts
  • packages/extension/src/scores/compiler.ts
  • packages/extension/src/scores/router.ts
  • packages/extension/src/substrate/vault_store.ts
  • packages/extension/test/scores/compiler.test.ts
  • packages/extension/test/scores/golden/compile-chained.md
  • packages/extension/test/scores/golden/compile-score.md
  • packages/extension/test/scores/golden/router-section.md
  • packages/extension/test/scores/overture_rewrite.test.ts
  • packages/extension/test/scores/overture_routing.test.ts
  • packages/extension/test/scores/prep_integration.test.ts

📝 Walkthrough

Walkthrough

The PR adds text-question defaults, rewrites overture onboarding around profile.json and filesystem completion markers, introduces the public design-a-pulse skill, and changes score compilation, routing, session preparation, and completion detection.

Changes

Onboarding and profile persistence

Layer / File(s) Summary
Question defaults
packages/app-bundle/overlay/packages/schema/src/question.ts, packages/app-bundle/overlay/packages/schema/src/v1/question.ts, packages/app-bundle/overlay/packages/app/src/pages/session/composer/session-question-dock.tsx
Question schemas now support optional text defaults. The question dock uses defaults when cached state is absent.
Profile-backed onboarding
packages/extension/scores/overture/SCORE.md, packages/extension/opencode-plugin/onboarding.ts, packages/extension/opencode-plugin/amicode_tools.ts, packages/extension/substrate/vault_store.ts, packages/extension/test/scores/golden/compile-chained.md, packages/extension/test/scores/overture_*
Overture now collects profile data through fixed stages, persists it to profile.json, supports resume and redo behavior, and records completion with a filesystem marker. Completion materializes merged profile data.
Pulse design skill
packages/extension/skills/design-a-pulse/SKILL.md
A public skill now defines platform selection, system modeling, target selection, formulation, solve execution, and run inspection.

Session routing and score compilation

Layer / File(s) Summary
Session orchestration
packages/extension/src/opencode_config.ts, packages/extension/src/substrate/vault_store.ts, packages/extension/test/scores/prep_integration.test.ts
Onboarding runs as a standalone overture. Later sessions inject routing and copilot content instead of a compiled primary score. State access covers the full Amico directory.
Score compilation and routing
packages/extension/src/scores/compiler.ts, packages/extension/src/scores/router.ts, packages/extension/test/scores/compiler.test.ts, packages/extension/test/scores/golden/compile-score.md, packages/extension/test/scores/golden/router-section.md
Compiled scores use a splice marker and dynamic headings. The router sends pulse requests to design-a-pulse, joins supplied problems to matching workflows, and excludes onboarding cards.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Session
  participant Router
  participant DesignAPulse
  participant AmicoTools
  Session->>Router: provide live state and opening request
  Router->>DesignAPulse: invoke pulse-design workflow
  DesignAPulse->>AmicoTools: record staged choices
  DesignAPulse-->>Session: report solve or inspection status
Loading

Suggested reviewers: aarontrowbridge

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch profile-onboarding-bridge

Comment @coderabbitai help to get the list of available commands.

- Expand ENTITY_FIELDS.profile to accept description, research_area,
  experiment_kind, scholar, github, custom_link_url, custom_link_label
  (previously silently dropped by sanitizePayload)
- Add 'links' stage to overture SCORE: asks for Scholar, GitHub, and
  custom link URLs (all optional/skippable)
- Add materializeProfileJson(): on onboarding_completed, replay the
  events stream and write identity fields to ~/.amico/profile.json
  (additive merge — never clobbers fields already set by inline editor)
- Update amicode_profile tool description to document new fields
- Regenerate golden snapshot

Field mapping (onboarding → profile.json):
  name → name, role → role, org → affiliation, research_area → focus,
  description → description, scholar → scholar, github → github,
  custom_link_url + custom_link_label → custom_link: {url, label}

Part of harmoniqs/opencode#231
The overture (generic researcher onboarding) was chained directly into
the pulse-designer interview, forcing quantum-specific questions on all
users immediately after onboarding. This made no sense for a
domain-neutral product.

Now the overture runs standalone. The pulse-designer (or any domain
interview) starts in a subsequent session via the onset router, only
when the user actively chooses it.

- Remove compileChainedScore/chainManifest usage from routing
- shouldOnboard no longer requires score0 (pulse-designer) to be present
- Update routing test to expect standalone overture behavior
… exists

When onboarding runs on a user who already has a complete profile (all of
name, intent, goals present), the overture now asks 'keep my current
profile' or 'start fresh' before proceeding. Prevents the interview from
skipping all stages and doing nothing useful on a redo.

Partial profiles (resumed sessions) still skip answered stages as before.
The question tool requires an options array with label+description for
choice questions. Clarify the SCORE instruction to explicitly specify
the options format so the agent generates valid tool calls.
When events.jsonl is empty/missing (e.g. the agent wrote the profile via
a different path), the bridge now accepts an optional inline profile
payload so profile.json is still written. This closes the edge case where
redo-onboarding clears events.jsonl but the distiller writes the vault
note from session context.
…ol call

The agent was generating invalid question tool calls (missing options
array) because the instruction format was ambiguous. Now includes the
exact JSON payload so the agent produces a valid choice question.
…e intent

Reorder stages so the identity card fields are collected first:
1. orientation: name → role → affiliation (was just name)
2. links: Scholar, GitHub, custom link (was stage 8, now stage 2)
3. context_seed (unchanged)
4. intent (unchanged)
5-9. goals, research_area, environment, devices, handoff (unchanged)

This ensures the profile dropdown is populated with the core identity
fields early in the interview, and link pills are filled before the
more domain-specific questions.
…g path

The agent was bypassing the events pipeline and writing profile data
directly to vault markdown files. This left events.jsonl empty and
profile.json never got written (the dropdown was blank).

Add an explicit HARD RULE in the SCORE body forbidding any path other
than amicode_profile for recording onboarding answers.
…uestions

The question tool schema requires the 'options' key even for kind:'text'
questions (it can be an empty array but must be present). The agent was
omitting it, causing SchemaError. Updated the protocol instruction to
make this explicit.
…ystem writes

Three issues addressed:

1. Jargon leakage: agent was saying 'vault', 'distiller', 'materialize',
   'events pipeline' etc. to users during onboarding. Added strict language
   rules that ban all internal/infrastructure terms from user-facing dialogue.

2. Filesystem writes: agent was bypassing amicode_profile and writing directly
   to ~/.amico/ files (events.jsonl, vault notes, etc.). Added an absolute
   filesystem prohibition — the agent must NEVER write/edit/create any file
   under ~/.amico/ during onboarding. The only persistence path is
   amicode_profile; if unavailable, nothing is saved (transcript is backup).

3. Tone: rewrote the persona and greeting to be warmer and more conversational.
   'Ciao — I'm Amico. Let me get to know you a little so I can be actually
   useful from the start.' instead of the transactional 'I'll remember your
   setup so we can move fast.'

Also: added tool-unavailability fallback (proceed fresh if amicode_profile
isn't in tool list, never tell user about tool issues).
@jeonghun-jj-lee
jeonghun-jj-lee force-pushed the profile-onboarding-bridge branch from e4edfc5 to cf607fb Compare August 23, 2026 12:22
The overture was drifting off-script — asking about transmon parameters,
generating invalid question calls, and conflating onboarding with the
pulse-designer interview. Root causes:

1. Too many conditional stages (environment, devices, context_seed) gave the
   agent room to improvise and branch incorrectly.
2. No explicit scope fence — the agent could see the pulse-designer interview
   in the same compiled prompt and sometimes started running it.
3. Free-form guidance ('weave naturally') invited freestyle.

Fix: rewrite to exactly 6 stages with mechanical instructions:
  1. orientation (name, role, affiliation)
  2. links (scholar, github, custom — all skippable)
  3. intent (multi-select)
  4. goals (free text)
  5. research_area (only if experiments intent — 2 questions)
  6. handoff (auto-description + completion marker)

Removed: context_seed (move to a post-onboarding flow), environment, devices
(these are pulse-designer concerns, not profile concerns).

Added a SCOPE FENCE at the top: explicit prohibition on asking about quantum
hardware, Hamiltonians, pulse parameters, etc. Those belong to a different
interview in a different session.

Added a hard STOP fence at the end: after Stage 6, the interview is OVER —
no more questions, no pulse-designer, no suggested next steps beyond 'start
a new session.'
…, not pulse-designer

The compiler was hardcoding '## Pulse-designer interview' as the heading for
ALL compiled scores — including the overture. The agent would see that heading
during onboarding and naturally think it should run a pulse-designer interview.

Fix: compileScore now uses a dynamic heading based on the score id:
- 'overture' → '## Onboarding interview'
- anything else → '## Pulse-designer interview'

Also: added a hidden HTML comment marker (SPLICE_MARKER) so spliceIntoAgentsMd
can locate the section reliably regardless of heading text. Falls back to the
legacy heading for backward compat.
…demand only

The full pulse-designer interview (270 lines of quantum-specific protocol)
was being compiled into EVERY post-onboarding session's AGENTS.md. This
polluted the context for general users and caused the agent to proactively
start pulse-design interviews even when users just wanted to code.

Now: post-onboarding sessions get only the onset router + a minimal stub
that says 'you are a general-purpose autoresearch copilot, do NOT start
domain interviews unless explicitly asked.' The pulse-design workflow is
still available on-demand via the skill system (transmon, atoms, bosonic,
etc.) when the user asks for it.

Also updated the onset router to remove pulse-designer-centric framing:
- Removed the SYSTEM_FIRST_SCORE constant
- 'Design a new pulse' is now described generically (invoke platform skill)
- Router language no longer references 'the interview below'
…mand content

Created skills/design-a-pulse/SKILL.md: the orchestration guide for walking
a user through pulse design (platform → model → formulation → solve → inspect).
It's a thin coordination layer that tells the agent which platform skills to
invoke (transmon, atoms, bosonic, etc.) and what stages to follow.

This replaces the old approach of compiling the full pulse-designer SCORE body
into every session's system prompt. Now it loads on-demand when the user asks
to design a pulse, keeping general sessions lean.

Also updated the onset router to reference the skill by name:
'invoke the design-a-pulse skill for the guided interview.'
Two issues fixed:

1. The amicode_profile plugin tool wasn't loading (the local-built opencode
   binary silently failed to import it), so the onboarding agent had no way
   to persist answers. Fix: the SCORE now instructs the agent to write
   ~/.amico/profile.json directly using standard file tools. The plugin tool
   is nice-to-have for analytics but no longer the critical path.

2. The link questions (Scholar, GitHub, custom) didn't pre-fill with 'skip',
   forcing users to type it. Fix: added `default` field support to the
   question schema overlay + UI initialization from it, and the SCORE now
   passes `default: "skip"` on each link question.

Changes:
- Grant ~/.amico/** in external_directory permissions (subsumes library,
  problems, onboarding — all already under ~/.amico)
- SCORE rewritten: reads/writes ~/.amico/profile.json directly; completion
  marker is now a file (~/.amico/amicode/onboarding/completed)
- hasOnboardingCompleted() checks for both the new file marker and the
  legacy events.jsonl marker
- QuestionV2 schema overlay + SDK types: added optional `default` field
- session-question-dock.tsx: initializes text input from question.default
- Tests updated to match new SCORE content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hitl Human-in-the-loop — needs human review/decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant