Skip to content

Comments

Scaffold full commandlayer/router production implementation#2

Open
GsCommand wants to merge 2 commits intomainfrom
claude/commandlayer-full-stack-work-Mvrou
Open

Scaffold full commandlayer/router production implementation#2
GsCommand wants to merge 2 commits intomainfrom
claude/commandlayer-full-stack-work-Mvrou

Conversation

@GsCommand
Copy link
Contributor

Implements the complete CommandLayer Router as a production-grade TypeScript repo from scratch on the feature branch.

What's included

Core

  • POST /run/v1.0.0 supporting explicit plan mode and scored mode (no LLM)
  • Deterministic score function: 0.40relevance + 0.30need_bonus + 0.10*novelty
    • 0.10cost_penalty + 0.10risk_penalty; tie-break alphabetical
  • Prerequisite graph: fetch→clean→summarize→classify→parse→analyze→format
  • Schema-shaped request builders per verb (fetch special: x402+source only)
  • Append-only RunState: artifacts, trace, decisions
  • Stop conditions: final artifact, score<=0, max_steps, timeout, max_receipts

Infrastructure

  • Ed25519 + SHA-256 + json.sorted_keys.v1 receipt signing/verification
  • ENS TXT pubkey resolution for runtime.commandlayer.eth (?ens=1)
  • AJV schema warm queue (background, non-blocking); POST /debug/prewarm → 202
  • /verify?schema=1: cached-only mode returns 202 + retry_after_ms
  • SSRF guard for fetch: blocks private IPs, localhost, IPv6, metadata service
  • In-memory idempotency cache with SHA-256 key derivation
  • NDJSON replay logs per run; GET /replay/:run_id endpoint
  • HTTP delegate mode via RuntimeClient (RUNTIME_URL env)
  • Local reference handlers for demo/test (no RUNTIME_URL needed)
  • CLI: cl-router run --goal/--content/--source/--plan

ENS Anchors (source of truth embedded)

  • runtime.commandlayer.eth: alg=ed25519, kid=v1, canonical=json.sorted_keys.v1
  • cleanagent.eth: canonical example of Commons agent TXT record shape

Tests (37 passing)

  • scoring: verb selection, policy, stop conditions, tie-break, novelty penalty
  • prereqs: all 10 verbs, conditions, edge cases
  • requestBuilders: fetch vs non-fetch schema shapes, idempotency_key, limits
  • idempotency: cache hit/miss, null result, stable stringify
  • engine: scored/explicit modes, conditions, optional steps, unique run_ids

Docs

  • SPEC.md: full /run/v1.0.0 spec, score function, prereq graph, state model
  • API.md: all endpoints + env vars reference
  • CONTRACTS.md: RunRequest/RunResponse/RunState types, receipt expectations
  • INTEGRATION_RUNTIME.md: HTTP delegate and drop-in block patterns
  • INTEGRATION_SITE.md: site docs update guide
  • EXAMPLES.md: curl/CLI/SDK usage examples with ENS anchor reference

https://claude.ai/code/session_01TjunT4KVR59QhARYaw2nUE

Implements the complete CommandLayer Router as a production-grade TypeScript
repo from scratch on the feature branch.

## What's included

### Core
- POST /run/v1.0.0 supporting explicit plan mode and scored mode (no LLM)
- Deterministic score function: 0.40*relevance + 0.30*need_bonus + 0.10*novelty
  + 0.10*cost_penalty + 0.10*risk_penalty; tie-break alphabetical
- Prerequisite graph: fetch→clean→summarize→classify→parse→analyze→format
- Schema-shaped request builders per verb (fetch special: x402+source only)
- Append-only RunState: artifacts, trace, decisions
- Stop conditions: final artifact, score<=0, max_steps, timeout, max_receipts

### Infrastructure
- Ed25519 + SHA-256 + json.sorted_keys.v1 receipt signing/verification
- ENS TXT pubkey resolution for runtime.commandlayer.eth (?ens=1)
- AJV schema warm queue (background, non-blocking); POST /debug/prewarm → 202
- /verify?schema=1: cached-only mode returns 202 + retry_after_ms
- SSRF guard for fetch: blocks private IPs, localhost, IPv6, metadata service
- In-memory idempotency cache with SHA-256 key derivation
- NDJSON replay logs per run; GET /replay/:run_id endpoint
- HTTP delegate mode via RuntimeClient (RUNTIME_URL env)
- Local reference handlers for demo/test (no RUNTIME_URL needed)
- CLI: cl-router run --goal/--content/--source/--plan

### ENS Anchors (source of truth embedded)
- runtime.commandlayer.eth: alg=ed25519, kid=v1, canonical=json.sorted_keys.v1
- cleanagent.eth: canonical example of Commons agent TXT record shape

### Tests (37 passing)
- scoring: verb selection, policy, stop conditions, tie-break, novelty penalty
- prereqs: all 10 verbs, conditions, edge cases
- requestBuilders: fetch vs non-fetch schema shapes, idempotency_key, limits
- idempotency: cache hit/miss, null result, stable stringify
- engine: scored/explicit modes, conditions, optional steps, unique run_ids

### Docs
- SPEC.md: full /run/v1.0.0 spec, score function, prereq graph, state model
- API.md: all endpoints + env vars reference
- CONTRACTS.md: RunRequest/RunResponse/RunState types, receipt expectations
- INTEGRATION_RUNTIME.md: HTTP delegate and drop-in block patterns
- INTEGRATION_SITE.md: site docs update guide
- EXAMPLES.md: curl/CLI/SDK usage examples with ENS anchor reference

https://claude.ai/code/session_01TjunT4KVR59QhARYaw2nUE
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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