Skip to content

Feature Request: Reuse .ck Index from Parent Directories #108

Description

@stoerr

Problem

When running ck inside a subdirectory of an already indexed project, a new .ck directory is created in that subdirectory. This leads to redundant indexes, increased disk usage, and unnecessary re-indexing work.

Proposed Behavior

When executed in a subdirectory, ck should:

  1. Traverse upward from the current working directory to locate an existing .ck directory.
  2. If found, reuse that index instead of creating a new one.
  3. Scope search results to files within the current subdirectory only.

Example

Given:

project/
.ck/
src/
module/

Running:

cd project/src/module
ck “query”

Expected behavior:

  • Use project/.ck as the index
  • Return only results under project/src/module

Optional Optimization

For performance, ck could optionally:

  • Prioritize scanning and updating only files within the current subdirectory
  • Defer or avoid reprocessing unrelated parts of the repository

Benefits

  • Avoids duplicate .ck directories
  • Reduces disk usage and indexing time
  • Improves usability in nested workflows
  • Aligns with common tooling patterns (e.g., git, npm, etc.)

Notes / Open Questions

  • Should there be a flag to disable parent lookup (e.g., --no-parent-index)?

Thanks so much for building such a wonderful tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions