Skip to content

fix(supermemory): document canonical API surface, ship anti-patterns reference#2

Open
Dhravya wants to merge 1 commit into
mainfrom
fix/ai-codegen-anti-patterns
Open

fix(supermemory): document canonical API surface, ship anti-patterns reference#2
Dhravya wants to merge 1 commit into
mainfrom
fix/ai-codegen-anti-patterns

Conversation

@Dhravya
Copy link
Copy Markdown
Member

@Dhravya Dhravya commented May 19, 2026

Motivation

A survey of 52 hackathon projects that integrate Supermemory found the same handful of AI-codegen failure modes over and over:

  • Fabricated endpoints (/v1/search, GET /search)
  • Fabricated/misapplied headers (x-project-id, X-Workspace-Id, x-sm-user-id outside infinite-context, x-sm-project outside MCP)
  • Deprecated containerTags plural array in body — currently the canonical shape in this skill's docs
  • Missing containerTag scoping (about a sixth of projects had no scoping at all — every user's data collapsed into one bucket)
  • Non-existent SDK methods (search.execute, documents.add, documents.deleteBulk, documents.batch_add, memories.list, memories.updateMemory)
  • Hallucinated kwargs (chunk_threshold, sort, order, include_content, include_full_docs)

This skill was unintentionally reinforcing several of these — README.md pointed agents at POST /v3/search, references/api-reference.md documented containerTags (plural) as the canonical search param, and references/sdk-integrations.md used containerTags: [\"user_123\"] in every TypeScript and Python example.

Changes

  • `SKILL.md` — added a Canonical API Surface + Things to never emit block near the top so agents see it before reading anything else.
  • `references/anti-patterns.md` (new) — catalogues every invented header, endpoint, body field, SDK method, and kwarg found in the survey, paired with the canonical replacement. `SKILL.md` now lists it as the first reference.
  • `references/api-reference.md` — rewrote the v4 search request-body table to use the real v4 params (`q`, `containerTag`, `threshold`, `rerank`, `rewriteQuery`, `searchMode`), with a note about legacy names for back-compat.
  • `references/sdk-integrations.md` — fixed all 10 occurrences of `containerTags: ["..."]` / `container_tags=["..."]` (TS + Python) to `containerTag` singular. Also renamed `search.documents` → `search.memories`.
  • `references/use-cases.md` — replaced the mixed `containerTags[0]` / `containerTag` pattern with two scoped searches merged by similarity (the correct way to search across user + shared org data).
  • `README.md` — corrected the REST endpoint list (`/v4/search` instead of `/v3/search`, added `/v4/profile`).
  • `SKILL.md` "Best Practices" — now requires `Authorization: Bearer`, singular `containerTag`, and `/v4/search`.

Out of scope (intentional)

The API still accepts `x-supermemory-api-key`, `x-api-key`, `containerTags` plural, and `/v3/search` for back-compat — this PR doesn't break any of that. It just stops documenting those patterns as canonical and explicitly steers AI codegen toward the v4/Bearer/singular path.

Test plan

  • Re-read `SKILL.md` top-to-bottom as if I were a fresh agent — does the canonical surface arrive before any code example? Yes.
  • Grep for any remaining `containerTags: [` / `container_tags=[` in code blocks — only present in anti-pattern callouts now.
  • Confirm `references/anti-patterns.md` is linked from `SKILL.md` Reference Documentation section.

🤖 Generated with Claude Code

…reference

A survey of 52 hackathon projects that integrate Supermemory found the
same handful of AI-codegen failure modes over and over: fabricated
endpoints, fabricated headers, deprecated plural containerTags, missing
containerTag scoping, and SDK methods that don't exist. This skill was
contributing to the problem — README and references pointed at
/v3/search, the API-reference table documented containerTags (plural)
as the canonical parameter, and the SDK integrations file used
containerTags: ["user_123"] in every TS and Python example.

This PR:

- Adds a "Canonical API Surface" + "Things to never emit" block near
  the top of SKILL.md so agents see it before reading anything else.
- Adds references/anti-patterns.md cataloguing every invented header,
  endpoint, body field, SDK method, and kwarg, paired with the
  canonical replacement. SKILL.md links to it as the first reference.
- Rewrites the v4 search request body table in api-reference.md to
  use q, containerTag, threshold, rerank, rewriteQuery (the actual
  v4 params) and notes the legacy names.
- Fixes all 10 containerTags: ["..."] / container_tags=["..."] uses
  in sdk-integrations.md (TS + Python) to containerTag singular.
- Fixes the mixed containerTags[0]/containerTag pattern in
  use-cases.md by splitting the search into two scoped calls and
  merging by similarity.
- Updates "Best Practices" to require Authorization: Bearer, singular
  containerTag, /v4/search.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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