Skip to content

Add search guide documentation#49

Open
skylabs-Usama wants to merge 1 commit into
mainfrom
docs/search-guide
Open

Add search guide documentation#49
skylabs-Usama wants to merge 1 commit into
mainfrom
docs/search-guide

Conversation

@skylabs-Usama
Copy link
Copy Markdown
Contributor

SEARCH_GUIDE.md is intended to explain the code to someone unfamiliar with the framework, demonstrate a dry run and also show how to trace success and failure paths.

Important if anyone wants to start using this code.

Goals:
Needs to be short enough to read quickly and still know enough about what each component does.

SEARCH_GUIDE.md is intended to explain the code to someone unfamiliar with the framework, demonstrate a dry run and also show how to trace success and failure paths.
@skylabs-ai-ci
Copy link
Copy Markdown

skylabs-ai-ci Bot commented Dec 29, 2025

CI summary (Details)

Active Repos

Repo Job Branch Job Commit Base commit PR
fmdeps/rocq-agent-toolkit/ docs/search-guide f959f79 9f1d636 #49

Passive Repos

Repo Job Branch Job Commit
./ main 3a1b852
fmdeps/BRiCk/ main 05404ad
fmdeps/auto/ main ed3ad10
fmdeps/auto-docs/ main b22de96
bluerock/NOVA/ skylabs-proof 220d4a8
bluerock/bhv/ skylabs-main 2a6d6bf
fmdeps/brick-libcpp/ main f36c2bf
fmdeps/ci/ main 753057b
fmdeps/vendored/elpi/ skylabs-master aa4475f
fmdeps/fm-ci/ main cfedfa4
fmdeps/fm-tools/ main 6e85551
psi/protos/ main 8fe3e7c
psi/backend/ main 291c63e
psi/ide/ main 6b596cf
psi/data/ main b803c5e
fmdeps/vendored/rocq/ skylabs-master 6d192b5
fmdeps/vendored/rocq-elpi/ skylabs-master e7c8227
fmdeps/vendored/rocq-equations/ skylabs-main 737fdf9
fmdeps/vendored/rocq-ext-lib/ skylabs-master 8172052
fmdeps/vendored/rocq-iris/ skylabs-master 51c753a
fmdeps/vendored/rocq-lsp/ skylabs-main a8b7272
fmdeps/vendored/rocq-stdlib/ skylabs-master 10bd9d7
fmdeps/vendored/rocq-stdpp/ skylabs-master 8307c10
fmdeps/skylabs-fm/ main 0a313b6
fmdeps/vendored/vsrocq/ skylabs-main 39c9c5b

Performance

Relative Master MR Change Filename
+0.00% 121991.5 121991.5 +0.0 total
+0.00% 24270.5 24270.5 +0.0 ├ translation units
+0.00% 97721.0 97721.0 +0.0 └ proofs and tests
Full Results
Relative Master MR Change Filename
+0.00% 121991.5 121991.5 +0.0 total
+0.00% 24270.5 24270.5 +0.0 ├ translation units
+0.00% 97721.0 97721.0 +0.0 └ proofs and tests

@skylabs-ai-ci
Copy link
Copy Markdown

skylabs-ai-ci Bot commented Dec 29, 2025

CI summary (Details)

Active Repos

Repo Job Branch Job Commit Base commit PR
fmdeps/rocq-agent-toolkit/ docs/search-guide f959f79 9f1d636 #49

Passive Repos

Repo Job Branch Job Commit
./ main 3a1b852
fmdeps/BRiCk/ main 05404ad
fmdeps/auto/ main ed3ad10
fmdeps/auto-docs/ main b22de96
bluerock/NOVA/ skylabs-proof 220d4a8
bluerock/bhv/ skylabs-main 2a6d6bf
fmdeps/brick-libcpp/ main f36c2bf
fmdeps/ci/ main 753057b
fmdeps/vendored/elpi/ skylabs-master aa4475f
fmdeps/fm-ci/ main cfedfa4
fmdeps/fm-tools/ main 6e85551
psi/protos/ main 8fe3e7c
psi/backend/ main 291c63e
psi/ide/ main 6b596cf
psi/data/ main b803c5e
fmdeps/vendored/rocq/ skylabs-master 6d192b5
fmdeps/vendored/rocq-elpi/ skylabs-master e7c8227
fmdeps/vendored/rocq-equations/ skylabs-main 737fdf9
fmdeps/vendored/rocq-ext-lib/ skylabs-master 8172052
fmdeps/vendored/rocq-iris/ skylabs-master 51c753a
fmdeps/vendored/rocq-lsp/ skylabs-main a8b7272
fmdeps/vendored/rocq-stdlib/ skylabs-master 10bd9d7
fmdeps/vendored/rocq-stdpp/ skylabs-master 8307c10
fmdeps/skylabs-fm/ main 0a313b6
fmdeps/vendored/vsrocq/ skylabs-main 39c9c5b

Performance

Relative Master MR Change Filename
+0.00% 121991.5 121991.5 +0.0 total
+0.00% 24270.5 24270.5 +0.0 ├ translation units
+0.00% 97721.0 97721.0 +0.0 └ proofs and tests
Full Results
Relative Master MR Change Filename
+0.00% 121991.5 121991.5 +0.0 total
+0.00% 24270.5 24270.5 +0.0 ├ translation units
+0.00% 97721.0 97721.0 +0.0 └ proofs and tests

| **Action** | "How do I execute this action?" | Run `cursor.insert_command("auto.")` |
| **Frontier** | "Which pending states should I explore next?" | Priority queue ordered by score |
| **Guidance** | "How promising is this state?" | Fewer remaining goals = better |
| **Node** | "What's the history of this search path?" | Tracks parent chain, depth, action keys |
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

improve

@@ -0,0 +1,342 @@
# Search Module Guide

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This information might be better to put inside the README.md file since it explains how to use the library.

Comment on lines +159 to +178
## Key Behaviors

### SingleDepth Clears on Depth Increase

When a node at depth N+1 is pushed and `max_depth` is N:
- The entire frontier is **cleared**
- Only depth N+1 nodes survive
- This is the "beam" behavior—discard shallower nodes

### PQueue Orders by Score

- Lower score = higher priority (explored first)
- Ties broken by insertion order
- Guidance provides the scoring function

### SavingSolutions Tracks Winners

- Checks `is_solution()` on every push
- If `stop_on_first_solution=True`, stops search immediately
- Otherwise, collects all solutions found
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These probably belong in the code.

Comment on lines +206 to +223
### Running a Search

```python
from rocq_pipeline.search.search.beam import BeamSearch
from rocq_pipeline.search.rocq.actions import RocqTacticAction
from rocq_pipeline.search.rocq.manip import RocqManipulator

search = BeamSearch(
strategy=my_strategy,
is_solved=lambda cursor: cursor.current_goal() is None,
beam_width=5,
explore_width=10,
max_depth=50,
stop_on_first_solution=True,
freshen=RocqManipulator(),
)

solutions = search.search(initial_cursor)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should put these examples inside the source code so that they are type checked. Otherwise, they are likely to bit-rot as the code evolves.

Comment on lines +287 to +311
To capture the complete search tree including failures, use OpenTelemetry-style tracing in `search.py`:

```python
# In search.py process() function

with trace_context("search_action") as span:
span.set_attribute("parent.id", id(candidate))
span.set_attribute("parent.depth", candidate.depth)
span.set_attribute("action.key", action_key)

fresh_state = smanip.copy(candidate.state)
try:
next_state = action.interact(fresh_state)
new_node = Node(next_state, candidate, action_key=action_key)
worklist.push(new_node, parent)

span.set_attribute("success", True)
span.set_attribute("child.id", id(new_node))

except Action.Failed as e:
smanip.dispose(fresh_state)

span.set_attribute("success", False)
span.set_attribute("error", e.message or "")
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code should be updated to actually include this. I started this here: #56

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.

2 participants