Skip to content

feat: CoMSES Net integration (5 tools + 1 prompt, safe extraction, cache pinning)#1

Closed
Razee4315 wants to merge 4 commits intomainfrom
feat/comses-integration
Closed

feat: CoMSES Net integration (5 tools + 1 prompt, safe extraction, cache pinning)#1
Razee4315 wants to merge 4 commits intomainfrom
feat/comses-integration

Conversation

@Razee4315
Copy link
Copy Markdown
Owner

Summary

Implements the full COMSES integration per docs/COMSES_PLAN.md v5 — the trust-building deliverable Serge asked for on 2026-04-17.

  • 5 new tools: search_comses, get_comses_model, download_comses_model, open_comses_model, read_comses_files.
  • 1 new prompt: explore_comses — NetLogo-first, source-introspection, never fabricates commands, stops-and-asks on both empty-discovery and runtime-error cases.
  • Safe extraction: HEAD screen + mid-stream byte cap, zip-slip rejection, zip-bomb guard, atomic temp→final move with .comses_complete marker, race reconciliation.
  • "latest" pinning: resolved to a concrete version BEFORE any cache path is computed; returned to the AI so follow-up read_comses_files calls stay pinned to the same slot.
  • 44 new tests covering the retry matrix, zip safety, cache trust rules, file-selection rule, priority ordering, truncation, zero-match, and prompt-rule drift. 85 tests total, all passing.

Chunks landed on this branch

  1. d2f6741 — API client + retry + search_comses / get_comses_model
  2. 06ea207 — safe download pipeline + download_comses_model
  3. 7a394dcopen_comses_model + read_comses_files
  4. 758ab90explore_comses prompt + README + CHANGELOG + DEVELOPMENT.md

Test plan

  • 85 unit tests pass (python -m pytest) — 41 existing + 44 new
  • Ruff lint clean
  • Live smoke test against real COMSES with one NetLogo model (manual, post-merge)
  • Live smoke test against one non-NetLogo model (manual, post-merge)
  • Verify prompt flow end-to-end with Claude Code (manual, post-merge)

- ComsesClient: search, get_codebase, get_release, resolve_latest
- Retry policy: 502/503/504 + network errors, max 2 retries, never on 4xx
- search_comses, get_comses_model MCP tools
- httpx>=0.27 dep, COMSES_MAX_DOWNLOAD_MB env var
- download_release: resolve → HEAD → stream → safe extract → inspect
- Zip-slip, zip-bomb, atomic temp-to-final move, .comses_complete marker
- download_comses_model MCP tool
- open_comses_model: loads NetLogo models, returns resolved_version
- read_comses_files: priority ordering, byte-cap truncation, UTF-8 replace
- Zero-match case, errors-when-cache-missing, latest resolution
- Prompt: NetLogo-first, pins resolved_version, stops-and-asks on errors
- README + CHANGELOG + DEVELOPMENT.md updates
@Razee4315 Razee4315 force-pushed the feat/comses-integration branch from 758ab90 to 50315a8 Compare April 18, 2026 21:30
@Razee4315 Razee4315 closed this Apr 18, 2026
@Razee4315 Razee4315 deleted the feat/comses-integration branch April 18, 2026 21:31
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