{"id":46458984,"url":"https://github.com/repoforge-dev/authority-layer","last_synced_at":"2026-03-10T07:00:46.650Z","repository":{"id":341938137,"uuid":"1172096226","full_name":"repoforge-dev/authority-layer","owner":"repoforge-dev","description":"Runtime guardrails for AI agents that enforce token budgets, loop limits, and tool rate limits locally.","archived":false,"fork":false,"pushed_at":"2026-03-05T00:37:48.000Z","size":502,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-06T05:04:28.674Z","etag":null,"topics":["agent-runtime","agentic-ai","ai-agents","ai-guardrails","ai-infrastructure","execution-limits","llm-guardrails","nodejs","runtime-guardrails","runtime-safety","token-cost-control","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/repoforge-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-04T00:01:06.000Z","updated_at":"2026-03-05T00:43:06.000Z","dependencies_parsed_at":"2026-03-06T03:02:48.364Z","dependency_job_id":null,"html_url":"https://github.com/repoforge-dev/authority-layer","commit_stats":null,"previous_names":["032383justin/authority-layer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/repoforge-dev/authority-layer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repoforge-dev%2Fauthority-layer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repoforge-dev%2Fauthority-layer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repoforge-dev%2Fauthority-layer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repoforge-dev%2Fauthority-layer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/repoforge-dev","download_url":"https://codeload.github.com/repoforge-dev/authority-layer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repoforge-dev%2Fauthority-layer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30207389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-runtime","agentic-ai","ai-agents","ai-guardrails","ai-infrastructure","execution-limits","llm-guardrails","nodejs","runtime-guardrails","runtime-safety","token-cost-control","typescript"],"created_at":"2026-03-06T03:00:30.860Z","updated_at":"2026-03-07T04:01:17.144Z","avatar_url":"https://github.com/repoforge-dev.png","language":"TypeScript","readme":"# AuthorityLayer\n\n[![CI](https://github.com/032383justin/authority-layer/actions/workflows/ci.yml/badge.svg)](https://github.com/032383justin/authority-layer/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/authority-layer?color=blue)](https://www.npmjs.com/package/authority-layer)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Node.js \u003e= 18](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)\n\nHard execution and budget limits for autonomous agents — enforced locally.\n\n✔ No telemetry  \n✔ Works fully offline  \n✔ Fail-closed by default  \n✔ Zero runtime dependencies\n\n---\n\n## Why AuthorityLayer Exists\n\nAutonomous AI agents can fail in expensive, hard-to-detect ways:\n\n- **Runaway token spend** — a looping agent burns thousands of dollars before anyone notices\n- **Infinite tool loops** — agents retry the same failing call indefinitely\n- **Retry storms** — cascading failures hammer external APIs with no ceiling\n- **Cascading tool call explosions** — one agent spawns sub-calls that spawn more\n\nMost tooling detects these problems after they happen — in dashboards, alerts, or post-run analytics.\n\nAuthorityLayer prevents them inside the runtime, before cost or damage accumulates.\n\nIt helps developers:\n\n- prevent runaway LLM costs\n- stop infinite agent loops\n- limit AI agent tool calls per run and per minute\n- enforce runtime safety for autonomous agents\n\n---\n\n## Live Enforcement Demo (10-second example)\n\n![AuthorityLayer enforcement demo](https://raw.githubusercontent.com/032383justin/authority-layer/main/docs/assets/enforcement-demo.svg)\n\n---\n\n## Quick Start\n\n```bash\nnpm install authority-layer\n```\n\nVerify the install:\n\n```bash\nnpx authority-layer doctor\n```\n\n```\nAuthorityLayer Doctor  authority-layer@0.1.2\n\n  ✔  Node.js version \u003e= 18                  pass\n  ✔  crypto module (sha256)                 pass\n  ✔  AUTHORITY_LAYER_DISABLE not set        pass\n  ✔  core module loads offline              pass\n  ✔  AuthorityLayer instantiates            pass\n\nAll checks passed. AuthorityLayer is ready.\n```\n\n## CLI Tools\n\n| Command | What it does |\n|---------|-------------|\n| `npx authority-layer doctor` | Verify your installation passes all environment checks |\n| `npx authority-layer simulate` | Run a live enforcement simulation — see a halt in action without writing any code |\n\n---\n\n## Minimal Integration\n\n```typescript\nimport { AuthorityLayer, EnforcementHalt } from \"authority-layer\";\n\nconst authority = new AuthorityLayer({\n  budget:       { dailyUSD: 50 },           // Hard USD spend cap\n  loopGuard:    { maxToolCallsPerRun: 25 }, // Max tool calls per run\n  toolThrottle: { maxCallsPerMinute: 60 },  // Sliding-window rate cap\n});\n\ntry {\n  await authority.wrap(async () =\u003e {\n    const result = await authority.tool(\"llm.chat\", () =\u003e\n      callYourModel(prompt)\n    );\n    authority.recordSpend(calculateCostUSD(result));\n  });\n} catch (err) {\n  if (err instanceof EnforcementHalt) {\n    console.error(err.enforcement);\n    // { status: \"halted\", reason: \"budget_exceeded\", limit: 50, spent: 52.14, event_id: \"evt_...\" }\n  }\n}\n```\n\n---\n\n## Enforcement Primitives\n\nAuthorityLayer V1 provides three composable enforcement primitives. Each is opt-in — omit a config key to disable it.\n\nThese primitives enforce boundaries directly inside the execution loop — not in dashboards or external monitoring.\n\n| Primitive | Config key | What it enforces |\n|-----------|------------|------------------|\n| **Budget cap** | `budget.dailyUSD` | Cumulative USD spend across the process lifetime. Halts when spend exceeds the cap. → [docs](./docs/enforcement.md#1-budget-cap) |\n| **Loop guard** | `loopGuard.maxToolCallsPerRun` | Total tool calls per `wrap()` invocation. Counter resets each run. → [docs](./docs/enforcement.md#2-loop-guard) |\n| **Tool throttle** | `toolThrottle.maxCallsPerMinute` | Rate of tool calls using a sliding 60-second window — no fixed buckets. → [docs](./docs/enforcement.md#3-tool-throttle) |\n\nWhen a primitive breaches, AuthorityLayer throws a typed `EnforcementHalt` error with a structured `.enforcement` object. Execution never crashes silently.\n\n---\n\n## How AuthorityLayer Is Different\n\nMost AI guardrail tools focus on moderation or observability. AuthorityLayer focuses on **runtime enforcement**.\n\n| Tool type | What it does |\n|-----------|-------------|\n| Prompt guardrails | Filter or rewrite prompts and outputs |\n| Observability platforms | Analyze agent behavior after execution |\n| Cost analytics | Track and report token usage |\n| **AuthorityLayer** | Enforces hard limits **during** execution — halts immediately when a boundary is crossed |\n\n---\n\n## Documentation\n\n| Topic | File |\n|------|------|\n| Concepts \u0026 philosophy | [docs/concepts.md](./docs/concepts.md) |\n| Enforcement primitives | [docs/enforcement.md](./docs/enforcement.md) |\n| API reference | [docs/api.md](./docs/api.md) |\n| Integrity chain | [docs/integrity.md](./docs/integrity.md) |\n| Example run | `npm run example` |\n\n---\n\nAuthorityLayer is designed as a minimal enforcement primitive — not a platform, dashboard, or governance system.\n\n---\n\n## License\n\nMIT © 2025 AuthorityLayer Contributors\n\n[GitHub](https://github.com/032383justin/authority-layer) · [npm](https://www.npmjs.com/package/authority-layer) · [Issues](https://github.com/032383justin/authority-layer/issues)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepoforge-dev%2Fauthority-layer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepoforge-dev%2Fauthority-layer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepoforge-dev%2Fauthority-layer/lists"}