Skip to content

feat: /dewey-configure slash command to configure sources.yaml #122

Open

Description

@jflowers

Summary

Add a /dewey-configure slash command that helps users configure .uf/dewey/sources.yaml — the content-source file that drives Dewey's disk, GitHub, web, and code indexing. Today, users hand-edit this YAML and frequently get the schema wrong (missing id/type/name, invalid trust_tier, wrong per-type config keys), which surfaces later as confusing dewey status/dewey doctor failures.

The command is an interactive wizard that discovers what the user could index, asks the right questions, and writes a valid sources.yaml — optionally scriptable via flags.

Motivation

  • Schema errors are the top source of config frustration. SourceConfig requires id/type/name plus type-specific keys (disk: path; github: org+repos; web: urls; code: path+languages). A wizard can guarantee correctness instead of hoping the user reads the source.
  • The existing CLI dewey source add only supports github/web. Disk and code sources have no programmatic path — users must hand-edit YAML.
  • Discovery is the hard part. Users don't always know what's indexable: sibling repos, the current vault, docs directories, GitHub orgs they own, and web URLs buried in their markdown are all candidates. A read-only discovery pass can surface these as suggestions.

Proposed design

Command: /dewey-configure

A hybrid wizard + flags interaction model:

  • Default (interactive): a 4-phase Q&A wizard driven by read-only discovery.
  • Scripted: flags like --add github --org X --repos a,b,c skip the wizard for CI/automation.

The 4 phases:

  1. Discover (read-only) — cheap, non-destructive recon:
    • git rev-parse --show-toplevel, git remote -v, gh auth status
    • ls -d ../*/ for sibling directories + per-sibling git -C <dir> remote get-url origin
    • language manifests (go.mod, package.json, Cargo.toml, pyproject.toml, setup.py, requirements.txt, pom.xml)
    • ls docs/ *.md for markdown/vault density
    • read existing .uf/dewey/sources.yaml + .uf/dewey/config.yaml (never clobber without review)
  2. Select — present discovered candidates (checkbox multi-select) grouped by source type.
  3. Configure — ask type-specific + cross-cutting questions with sane defaults (details below).
  4. Review + write — show the final YAML, validate against the source package schema, then write via Read+Write tools (so dewey status/dewey doctor pass immediately).

Discovery → suggestions → questions, per source type

disk

  • Signals: Logseq vault (logseq/, .obsidian/, pages/+journals/, high .md density) → suggest path: "."; code repo with docs/ → suggest ./docs; sibling dirs → candidate disk sources.
  • Skip: .git, node_modules, vendor, build, dist, target, public.
  • Questions: which paths (pre-checked), recursive (default true), ignore patterns, id/name prefilled disk-<slug> / <basename>.

github

  • Signals: origin owner + upstream owner (if a fork); if authed, gh repo list <owner> for full repo enumeration; siblings sharing an owner → consolidate into one org-level source.
  • Questions: org/owner (discovered options), repos (multi-select), content (issues/pulls/readme, default all), refresh_interval (default daily).
  • Never ask for or persist a token — it's resolved at runtime (GITHUB_TOKEN → GH_TOKEN → gh auth token → unauthenticated).

web

  • Signals: extract URLs from repo markdown + manifests; classify docs vs homepage vs API vs image vs placeholder; filter out localhost/127.0.0.1/private hosts/*.example.com/image+badge URLs/API endpoints (.googleapis.com, /v1/, /api/); group by host (one web source per host, multiple urls).
  • Questions: which discovered URLs (grouped/deduped), depth (default 1), name (hostname), rate_limit (default 1s), sanitize_mode (default warn).
  • Fallback: open prompt to paste URLs when nothing is discovered.

code

  • Signals: language manifests, filtered against the chunker registry (only Go is registered today — chunker.Languages() → ["go"]). go.mod → suggest code with languages: [go], path: ".".
  • Non-Go languages detected → tell the user only Go is currently supported and offer disk-as-markdown as an alternative.
  • Monorepo → one code source per language dir.
  • Questions: path, languages (constrained), include/exclude (prefill exclude vendor/, generated/), recursive.

Cross-cutting (always ask — never guess)

  • trust_tier — default authored
  • sanitize_mode — default warn (web/github), off (disk/code)
  • refresh_interval — default daily (github), weekly (web), none (disk/code)
  • intent — this repo only vs. siblings; cross-reference vs. standalone

Schema validation

Before writing, validate against the real source package schema (validateSourceConfig): id (required, unique), type, name, per-type config keys, valid trust_tier (authored/curated/validated/draft/untrusted) and sanitize_mode (warn/strict/off).

Delivery scope

Two artifacts:

  1. .opencode/commands/dewey-configure.md — the slash command itself, following the existing format: YAML frontmatter (description:), # Command: /dewey-configure, ## Description, ## Usage, and a <protect>...## Instructions...</protect> block (the <protect> tags are honored by cli.go and dcp.jsonc).
  2. slash_commands.go — add dewey-configure.md to the deweySlashCommands map so dewey init scaffolds it into other repos. (Note: cli_test.go:751-752 asserts every map entry gets scaffolded — may need a test update.)

Process

This will be implemented via an OpenSpec change (/opsx-propose), following the precedent set by openspec/changes/dewey-store-command/ (.openspec.yaml, design.md, proposal.md, specs/command-behavior.md, tasks.md) and openspec/changes/protect-tags-slash-commands/.

Out of scope (for now)

  • Any source types beyond disk/github/web/code.
  • New chunker languages (only Go is supported today).
  • Changes to dewey source add itself.

Activity

  1. added
    enhancement
    on Sep 13, 2026
  2. fullsend-ai-triage commented on Sep 14, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 10:07 AM UTC · Completed 10:12 AM UTC

    Commit: d60b773 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $0.94

  3. fullsend-ai-triage commented on Sep 14, 2026

    @fullsend-ai-triage

    Triage Summary

    This is a well-specified feature request ready for implementation. A few notes for the implementer:

    Delivery artifacts are clearly scoped: the slash command .md file and a slash_commands.go map entry. The existing test at cli_test.go:751-752 asserts every map entry gets scaffolded — verify this passes after adding the new entry.

    Related issues:

    Proposed test case:

    // Verify dewey-configure.md is present in deweySlashCommands
    // and that dewey init scaffolds it into .opencode/commands/
    func TestInitScaffoldsDeweyConfigureCommand(t *testing.T) {
        // Setup: create temp dir with .opencode/
        // Run dewey init
        // Assert .opencode/commands/dewey-configure.md exists
        // Assert file contains expected frontmatter and <protect> block
    }

    Process note: The issue specifies implementation via OpenSpec (/opsx-propose), following the pattern established by openspec/changes/dewey-store-command/.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. jflowers commented on Oct 31, 2026

    @jflowers
    ContributorAuthor

    Extension from the knowledge-lifecycle planning session that produced the companion issues #132 (/dewey-publish), #133 (/dewey-distill), and #131 (the .gitignore bare-dewey bug). This issue remains the home for /dewey-configure; the deltas below refine its design without changing its goal.

    1. Determinism governance now applies to the discovery phase. The repo has since added .opencode/uf/packs/determinism.md + the determinism-first skill (DE-001/DE-003/DE-005/DE-007): mechanical steps — discovery enumeration, existence checks, output rendering — must live in an executable tool with tests, not prose wizard steps. Concretely, the Discover phase above should become a new DB-free CLI command (working name dewey analyze --json): git remotes → github-source candidates, markdown surfaces, language manifests filtered against chunker.Languages(), sibling repos, existing config state — golden-tested. The wizard's judgment (selection, questions, YAML composition) stays in the command layer, with DE-007 seam-verification tasks in tasks.md.

    2. Scope extends beyond sources.yaml. The user goal is "best configure the dewey sources and config files": the proposal should also cover .uf/dewey/config.yaml (embedding + synthesis — including proposing the new OpenAI-compatible synthesis provider, see #133) and .uf/dewey/knowledge-stores.yaml (curate stores). These are user-owned files: back up before write, and put a MANDATORY GATE before any overwrite.

    3. The verification path must account for the running server. While the MCP server runs it holds the exclusive dewey.lock flock (store/store.go:105-120), so dewey doctor / dewey status CLI verification fails beside it. Use MCP health for live DB state, and verify newly written config via MCP index (re-reads sources.yaml every run — tools/indexing.go:127,222) + health, without a server restart. Also note in the command output that new learning files are only re-ingested at server startup (main.go:1072).

    4. Suggested after-write flow: propose configs → MANDATORY GATE → write (with backup) → MCP index → MCP health verify → report.

    5. Packaging: planned as one OpenSpec change (opsx/dewey-lifecycle-commands) together with #132 and #133 — adjust if scope demands.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeaturetriaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions