Skip to content

fix(oracle): detect workspace state before greeting on no-arg invocation#94

Open
mt-alarcon wants to merge 1 commit into
evolution-foundation:mainfrom
mt-alarcon:fix/oracle-detect-state-before-greeting
Open

fix(oracle): detect workspace state before greeting on no-arg invocation#94
mt-alarcon wants to merge 1 commit into
evolution-foundation:mainfrom
mt-alarcon:fix/oracle-detect-state-before-greeting

Conversation

@mt-alarcon

@mt-alarcon mt-alarcon commented May 29, 2026

Copy link
Copy Markdown

Problem

The /oracle no-argument path greets every user as a new user and leads with the onboarding/consulting pitch ("me conta sobre sua empresa e eu monto um plano…"), even on a fully configured workspace with populated memory/, active heartbeats, and a filled-in config/workspace.yaml.

This contradicts Step 0 of the oracle agent spec (.claude/agents/oracle.md), which mandates:

"Before greeting, figure out where the user is… Classify: Fresh install / Fully configured / Partial… Never assume — always verify by reading." Fully configured → skip onboarding.

The command file never told the agent to run Step 0 on the no-arg path, so the generic new-user greeting won regardless of actual state.

Fix

Branch the no-arg greeting on detected workspace state:

  • fresh install → consultant greeting + two onboarding paths (unchanged behavior)
  • fully configured → returning-operator greeting that opens with a state recap (active projects, recent sessions, time-sensitive items), then offers to continue / start new / answer a question
  • partial → explain what's configured vs. missing, ask whether to resume setup or proceed

No behavior change for genuinely new installs; configured workspaces stop getting an onboarding pitch they don't need.

Scope

Single-file, prompt-only change to .claude/commands/oracle.md. No code, no schema, no dependencies.

🤖 Generated with Claude Code

Summary by Sourcery

Adjust Oracle's no-argument invocation behavior to detect workspace state before greeting and tailor the opening flow accordingly.

Enhancements:

  • Introduce workspace state classification (fresh install, fully configured, partial) for Oracle's no-arg path to drive different greeting flows.
  • Refine Oracle's greeting copy to avoid onboarding pitches for configured workspaces and clarify behavior for partial setups.

The /oracle no-argument path greeted every user as a new user and led
with the onboarding/consulting pitch, even on a fully configured
workspace with populated memory and active heartbeats. This contradicts
Step 0 of the oracle agent spec, which mandates detecting workspace
state before greeting and skipping onboarding when already configured.

Branch the no-arg greeting on detected state:
- fresh install  -> consultant greeting + two onboarding paths (as before)
- fully configured -> returning-operator greeting with a state recap
- partial          -> explain what's configured vs missing, ask to resume

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented May 29, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the Oracle agent's no-argument invocation behavior so it first detects workspace state (fresh, fully configured, partial) and branches the greeting accordingly, avoiding new-user onboarding pitches in configured workspaces.

Sequence diagram for oracle no-arg invocation workspace-state detection and greeting

sequenceDiagram
    actor User
    participant Oracle
    participant Workspace

    User->>Oracle: /oracle
    alt [no arguments]
        Oracle->>Workspace: read_config_workspace_yaml
        Oracle->>Workspace: glob_workspace_dirs
        Oracle->>Workspace: check_memory_content
        Oracle->>Workspace: check_scheduler_activity
        Oracle->>Oracle: classify_workspace_state

        alt [fresh install]
            Oracle-->>User: consultant_greeting_with_two_paths
        else [fully configured]
            Oracle-->>User: returning_operator_greeting_with_state_recap
        else [partial]
            Oracle-->>User: partial_setup_greeting_explain_and_offer_paths
        end
    else [arguments provided]
        Oracle-->>User: handle_argument_flow
    end
Loading

File-Level Changes

Change Details Files
Make the no-argument /oracle path run workspace state detection (Step 0) before greeting and branch responses by state classification.
  • Replace the previous generic consultant-style no-arg greeting with instructions to first read workspace configuration, memory, and scheduler activity to classify workspace state.
  • Define three workspace states (fresh install, fully configured, partial) with concrete criteria based on config/workspace.yaml, workspace directories, memory contents, and scheduler/heartbeats.
  • Specify tailored greeting and next-step flows for each state, including a returning-operator flow for fully configured workspaces and a setup-resume flow for partial workspaces.
  • Tighten guidance against dumping generic menus and clarify that onboarding-style business consultation is only the primary flow for fresh installs, while configured workspaces must lead with state-aware context.
.claude/commands/oracle.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider tightening the workspace-state detection criteria (e.g., how far back counts as 'scheduler has run recently', what constitutes 'memory populated') so the agent has unambiguous, deterministic rules for classifying edge cases between fresh/partial/fully configured states.
  • It may help to specify how to handle conflicting signals (e.g., owner/company set but empty memory, or active heartbeats but missing workspace.yaml) so the oracle follows a consistent priority order when deciding between 'fully configured' and 'partial'.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider tightening the workspace-state detection criteria (e.g., how far back counts as 'scheduler has run recently', what constitutes 'memory populated') so the agent has unambiguous, deterministic rules for classifying edge cases between fresh/partial/fully configured states.
- It may help to specify how to handle conflicting signals (e.g., owner/company set but empty memory, or active heartbeats but missing workspace.yaml) so the oracle follows a consistent priority order when deciding between 'fully configured' and 'partial'.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant