Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The skill routes internally to focused reference documents for:
- memory management
- built-in search engines
- custom search engine implementation
- downstream CMake consumption

## Contributing

Expand Down
12 changes: 12 additions & 0 deletions evals/gecode-trigger-evals.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"query": "Can you help debug a Gecode issue where a stored choice seems invalid after recomputation? The model uses custom branchers and I suspect I'm breaking clone or commit invariants.",
"should_trigger": true
},
{
"query": "I am packaging a C++ solver that depends on Gecode 6.3+ and I want the downstream CMake project to use find_package(Gecode CONFIG) with a FetchContent fallback when it's not installed.",
"should_trigger": true
},
{
"query": "Please model this scheduling problem in Gecode with strong global constraints, sensible symmetry breaking, and a branching strategy that focuses on the cost-driving variables first.",
"should_trigger": true
Expand All @@ -35,6 +39,10 @@
"query": "I'm using Gecode with a mix of discrete choices and continuous tolerances. What should I watch out for when float vars are part of the model, especially compared with ordinary integer branching intuition?",
"should_trigger": true
},
{
"query": "I need to clean up a generic CMakeLists.txt for a small SDL app. There is no Gecode involved, I just want better target_link_libraries usage and install rules.",
"should_trigger": false
},
{
"query": "How would you model a nurse rostering problem in constraint programming? I'm open to any solver or even OR-Tools, I mainly want high-level CP advice.",
"should_trigger": false
Expand All @@ -47,6 +55,10 @@
"query": "Can you explain branch and bound versus depth-first search in general terms? I don't need implementation details for any particular library.",
"should_trigger": false
},
{
"query": "I have an old FindFoo.cmake module and want to migrate to package config usage. The library is our in-house SDK, not Gecode.",
"should_trigger": false
},
{
"query": "What are good heuristics for graph coloring in CP, and how do I think about symmetry? Solver-agnostic advice is fine.",
"should_trigger": false
Expand Down
4 changes: 3 additions & 1 deletion skills/gecode/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: gecode
description: "Gecode architecture, modeling, cookbook-style modeling patterns, set/float/scheduling guidance, propagators, branchers, memory management, search engine usage and implementation, recomputation/cloning behavior, and debugging/performance diagnosis. Use for any materially Gecode-specific task: building or refining Gecode models, implementing custom constraints or branchers, tuning DFS/BAB/RBS/PBS/LDS search, diagnosing weak propagation or search pathologies, or reasoning about set/float/resource-style models."
description: "Gecode architecture, modeling, cookbook-style modeling patterns, set/float/scheduling guidance, propagators, branchers, memory management, search engine usage and implementation, recomputation/cloning behavior, debugging/performance diagnosis, and downstream CMake consumption. Use for any materially Gecode-specific task: building or refining Gecode models, implementing custom constraints or branchers, tuning DFS/BAB/RBS/PBS/LDS search, diagnosing weak propagation or search pathologies, reasoning about set/float/resource-style models, or integrating Gecode into CMake projects."
---

# Gecode
Expand Down Expand Up @@ -47,6 +47,7 @@ Use this skill as the entry point for any Gecode-specific task. Carry the univer
- Read `references/memory-handling.md` for space/region/heap allocation, handles, clone footprint, and disposal obligations.
- Read `references/search-engines.md` for using and tuning built-in engines such as `DFS`, `BAB`, `LDS`, restart, and portfolio search.
- Read `references/search-engine-implementation.md` for custom engine orchestration, recomputation strategy, LAO, and completeness invariants.
- Read `references/cmake-consumption.md` for `find_package(Gecode CONFIG)`, target usage, version checks, and vendored fallback patterns.
- Read `references/general-knowledge.md` only for broad conceptual explanations, tracing/observability guidance, or staged model-improvement workflow discussion that goes beyond the always-on mental model.

## Operating Rules
Expand All @@ -68,3 +69,4 @@ Use this skill as the entry point for any Gecode-specific task. Carry the univer
- `references/memory-handling.md`: memory areas, lazy vs eager allocation, shared/local handles, and `AP_DISPOSE` discipline.
- `references/search-engines.md`: engine selection, restart/portfolio tradeoffs, no-goods, parallel semantics, and completeness caveats.
- `references/search-engine-implementation.md`: custom engine state, replay/recomputation, ownership, branch-and-bound integration, and invariants.
- `references/cmake-consumption.md`: package-config integration, exported targets, component selection, and fetch fallback.
39 changes: 39 additions & 0 deletions skills/gecode/references/cmake-consumption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Gecode CMake Consumption

## Core
- Prefer config-package consumption: `find_package(Gecode CONFIG REQUIRED)`.
- Link downstream targets to `Gecode::gecode` unless explicit component granularity is required.
- Require `Gecode_VERSION >= 6.3.0` and use package version checks rather than parsing `gecode/support/config.hpp`.
- Hint package location with `Gecode_ROOT` or `CMAKE_PREFIX_PATH`.
- Keep `cmake_minimum_required(VERSION 3.21)` or newer for parity with Gecode's build.

## Key Patterns
- Minimal integration:
```cmake
find_package(Gecode CONFIG REQUIRED)
target_link_libraries(app PRIVATE Gecode::gecode)
```
- Component-specific integration:
```cmake
find_package(Gecode CONFIG REQUIRED COMPONENTS driver)
target_link_libraries(app PRIVATE Gecode::gecodedriver)
```
- Version guard:
```cmake
if(SOME_STRICT_OPTION AND Gecode_VERSION VERSION_LESS "6.3.0")
message(FATAL_ERROR "Gecode >= 6.3.0 required, found ${Gecode_VERSION}")
endif()
```
- Try installed package first with `find_package(Gecode CONFIG QUIET)` when discovery is optional.
- If the package is absent and project policy allows vendoring, use `FetchContent` and set Gecode cache options before `FetchContent_MakeAvailable(...)`.
- Require `TARGET Gecode::gecode` after resolution and fail fast with actionable error text if it is missing.
- Mark Gecode targets as `SYSTEM` in strict-warning projects to isolate third-party headers from local warning policy.
- For pinned source fallbacks, prefer stable release tags or commits over long-lived feature branches.
- When migrating away from custom discovery modules, remove manual imported-target composition and library probing once package config is the baseline.
- Keep strict version toggles if desired, but enforce them against `Gecode_VERSION`.

## Pitfalls
- Calling `find_package(Gecode REQUIRED)` without `CONFIG` and accidentally resolving old module-mode shims.
- Assuming optional components exist without checking enabled modules in the installed build.
- Mixing custom imported-target composition with package-provided targets in the same code path.
- Parsing headers for version when package metadata already provides `Gecode_VERSION`.