Skip to content

feat(lesswrong): add LessWrong adapter#773

Merged
jackwener merged 2 commits intojackwener:mainfrom
linxule:feat/lesswrong-adapter
Apr 4, 2026
Merged

feat(lesswrong): add LessWrong adapter#773
jackwener merged 2 commits intojackwener:mainfrom
linxule:feat/lesswrong-adapter

Conversation

@linxule
Copy link
Copy Markdown
Contributor

@linxule linxule commented Apr 4, 2026

Summary

  • Adds 15 commands for LessWrong, the rationality and AI alignment research community
  • All commands use the public GraphQL API — no browser or authentication required (Strategy.PUBLIC, browser: false)
  • Includes shared helper module (_helpers.ts) with GraphQL client, input sanitization, tag/user resolution

Commands

Command Description
curated Editor's picks
frontpage Algorithmic feed
new Latest posts
top Top rated (all time)
top-week / top-month / top-year Time-filtered top posts
read Full post content by URL or ID
comments Top comments on a post (with post title context)
user User profile (karma, bio, stats)
user-posts List a user's posts
tag Posts by tag (resolves slug → ID via tagBySlug view)
tags List popular tags
sequences Post collections
shortform Quick takes

Technical notes

  • Time filtering: Uses after date parameter (LessWrong's timeframe GraphQL param is silently ignored)
  • Tag lookup: Two-step resolution — resolve tag slug to Mongo _id via tagBySlug view, then query tagRelevance with the real ID
  • User slugs: Case-sensitive in the API; adapter normalizes to lowercase
  • Error handling: CommandExecutionError for API failures, EmptyResultError for not-found with actionable hints
  • Input sanitization: All user-provided strings escaped via gqlEscape() before GraphQL interpolation

Files

  • src/clis/lesswrong/ — 16 TypeScript files (15 commands + _helpers.ts)
  • docs/adapters/browser/lesswrong.md — adapter documentation
  • docs/adapters/index.md — added to Public API Adapters table
  • docs/.vitepress/config.mts — added sidebar entry

Test plan

  • All GraphQL queries verified against live LessWrong API
  • npx tsc --noEmit passes (exit 0)
  • Time-filtered views return correctly scoped posts (not all-time)
  • Tag resolution returns tag-specific posts (not unfiltered fallback)
  • User slug normalization works (e.g., "Zvi" → "zvi")
  • shortform and userPosts views confirmed working
  • Error cases tested: nonexistent tags, invalid post IDs, wrong usernames

🤖 Generated with Claude Code

linxule and others added 2 commits April 5, 2026 03:20
15 commands for the LessWrong rationality and AI alignment community:
- Post listings: curated, frontpage, new, top, top-week/month/year
- Content: read (full post), comments, shortform (quick takes)
- Discovery: tag, tags, sequences
- Users: user (profile), user-posts

All commands use the public GraphQL API (no browser required).
Time-filtered views use the `after` date parameter.
Tag lookup resolves slugs to IDs via the `tagBySlug` view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New adapter files were created at src/clis/lesswrong/ but PR jackwener#782 moved
all adapters to root clis/. Move to correct location.
@jackwener jackwener force-pushed the feat/lesswrong-adapter branch from d993d64 to 48cbd44 Compare April 4, 2026 19:20
@jackwener jackwener merged commit d2051cd into jackwener:main Apr 4, 2026
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