5 Commits

Author SHA1 Message Date
07a54ebeec feat: add scribase_memory_task — real persistent agent memory (store/recall/search/forget)
Hermes agents had no persistent memory via this plugin: scribase_query is
read-only (enforced by the control plane itself) and scribase_lint_migration
hardcodes apply:false, so none of the first four tools could ever write
application data, only inspect or lint it.

scribase_memory_task closes that gap using a real, previously-unused
endpoint read from the compiled control plane: POST .../database/execute
(the write-mode SQL route the Scribase Studio SQL editor uses in "write
mode", crates/control-api/src/adapters/sql_execute.rs), for store/forget;
recall/search reuse the existing read-only database/query route. Creates
its own table (hermes_agent_memories, RLS enabled) on first use, scoped by
an optional namespace so multiple agents/users can share a project without
reading each other's memories. Every value interpolated into SQL (content,
metadata, scope, memory_id) is escaped via the standard Postgres
string-literal escape (_sql_literal) — the model never passes raw SQL
through this tool.

Verified: a throwaway monkeypatched test exercises all 4 actions + error
paths + an injection-style content string (confirms balanced escaping, no
executable SQL smuggled through). Then ran the real, unmodified tools.py
directly against a real, no-login temporary Scribase project on production
api.scribase.com: store (x2) -> recall -> search -> scope-isolation check
(a second, never-used scope correctly returns zero rows) -> forget ->
recall again (confirms exactly the forgotten memory is gone, the other
survives). Full transcript in HACKATHON-SUBMISSION-2026-11-05.md.

Re-ran validate_plugin_dir() (the function `hermes plugins validate`
calls) against a fresh NousResearch/hermes-agent clone: 15/15 checks pass,
0 warnings, isolation host_ready: true, declared tools matches
registrations (5 tools, including scribase_memory_task).

plugin.yaml bumped to 1.3.0, provides_tools now lists all 5.
2026-11-06 18:16:17 +03:00
299e27c6a3 fix: send a User-Agent and drop the null ttl_hours that broke every real call
Found both bugs for real while running the plugin's own unmodified tools.py
against production api.scribase.com during the 2026-11-06 Hermes session demo
(not guessed, reproduced live):

- _request() never set a User-Agent, so a bare CPython urllib call (exactly
  what this plugin's handler sends) got hard-blocked by Cloudflare's WAF in
  front of api.scribase.com (403 browser_signature_banned) before reaching
  the control plane at all. Confirmed by replaying the identical
  "Python-urllib/3.x" User-Agent string via curl and getting the same block,
  then clearing it with a normal UA string and getting through.

- create_project()'s environment-create POST always sent "ttl_hours": null
  for a production environment (which has no TTL); the control plane's
  strict request-schema validator rejects an explicit null for that optional
  field with 400 invalid_json, while omitting the key entirely succeeds.
  Confirmed via an A/B curl replay of the exact same body with vs. without
  the key.

Verified after the fix: re-ran create_project and run_query from the fixed,
unmodified tools.py (no monkeypatching) against the real temporary project
created for this demo — create_project now reaches real conflict-detection
logic (409, environment already exists) instead of the WAF/schema errors,
and run_query returns real rows cleanly. Re-ran validate_plugin_dir() (the
function `hermes plugins validate` calls) against the fixed plugin: 15/15
checks pass, 0 warnings, isolation host_ready true.

version: 1.2.0 -> 1.2.1
2026-11-06 00:24:54 +03:00
427a20f712 feat: add scribase_branch_task — real copy-on-write branch create/promote/discard
Fourth tool: one action='create'|'promote'|'discard' tool that forks a real
copy-on-write Postgres branch for one agent task (POST /v1/environments,
kind="preview", bounded TTL so it always lands in the control plane's
agent-branch slot pool), three-way merges it back into its parent on
action='promote' (POST .../branches/merge, reads the real
applied/clean/changes/conflicts/statements fields the compiled server
renders, and surfaces a real mfa_required rejection on a forced merge
instead of hiding it), or deletes it outright on action='discard' (DELETE
.../environments/{env}). Built from the real control-api source
(http/environments.rs, http/branches.rs, adapters/branch.rs,
adapters/usage.rs::AGENT_BRANCH_MAX_TTL_HOURS) and the public
docs.scribase.com environments/branches pages, not guessed.

Factored create_project's polling and API-keys/connection readback into
shared _poll_operation/_read_environment_access helpers, reused by both
tools; create_project's own behavior is unchanged (verified with a mocked
HTTP layer, happy path and warning path).

plugin.yaml bumped to 1.2.0, provides_tools now lists all 4 tools.
README rewritten with a one-line pitch, a demo-video pointer, and a real
example call + example response for every tool. HACKATHON-SUBMISSION
updated with the new tool, a fresh validator run (15/15, 0 warnings), and
an honest demo-coverage note for the branch-task tool including two live
production responses from the real public /v1/demo/branch endpoint this
tool's workflow mirrors (a transient 402, then the real 429 per-hour rate
limit — both genuine, neither invented).
2026-11-05 23:48:28 +03:00
c68e4761b7 feat: add scribase_lint_migration and scribase_query tools
Expands the plugin from one tool to three, each backed by a real,
distinct api.scribase.com endpoint:

- scribase_lint_migration: POST .../migrations with apply hardcoded to
  false, so it only ever runs the control plane's real migration-safety
  linter (missing RLS, GRANT to PUBLIC, USING (true) policies, writes
  with no WITH CHECK, SECURITY DEFINER functions block; a missing FK
  index warns) and never touches the tenant database. This is a
  capability no generic prompt or skill can replicate — it requires
  parsing SQL against actual Postgres lock/RLS semantics.
- scribase_query: POST .../database/query, a single read-only statement
  run inside a Postgres READ ONLY transaction, enforced twice by the
  server (lexical check, then transactional) — never by this client.

Bumped plugin.yaml to version 1.1.0, provides_tools now lists all three
tools, requires_hermes raised to >=0.20.1 to match the floor the
maintainer set on the already-merged catalog entry. Re-validated with
hermes-agent's own admission checker (validate_plugin_dir): 15/15
checks pass, 0 warnings, isolation host_ready true, declared tools
match registrations exactly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-05 23:14:23 +03:00
dfce6f241d feat: Scribase plugin for Hermes Agent — scribase_create_project tool
Provisions a hosted Postgres backend project on Scribase (api.scribase.com)
via its public REST API and returns the new environment's connection
string and API keys. Registers a single tool (ctx.register_tool) and reads
its API key through Hermes's secret scope (agent.secret_scope.get_secret);
no other Hermes surfaces, no third-party dependencies.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-05 18:52:29 +03:00