{"record":{"id":"cb0225e06aa8390b","repo":"ruvnet/ruflo","slug":"amendment-rate-limit-exceeded-this-maxamendment","errorCode":null,"errorMessage":"Amendment rate limit exceeded: ${this.maxAmendmentsPerWindow} per ${this.amendmentWindowMs}ms","messagePattern":"Amendment rate limit exceeded: (.+?) per (.+?)ms","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"v3/@claude-flow/guidance/src/meta-governance.ts","lineNumber":368,"sourceCode":"      results,\n      timestamp: Date.now(),\n    };\n  }\n\n  /**\n   * Propose a new amendment\n   */\n  proposeAmendment(\n    proposal: Omit<Amendment, 'id' | 'timestamp' | 'status' | 'votes'>\n  ): Amendment {\n    // Check rate limiting\n    const now = Date.now();\n    const recentAmendments = this.amendmentHistory.filter(\n      (a) => now - a.timestamp < this.amendmentWindowMs\n    );\n\n    if (recentAmendments.length >= this.maxAmendmentsPerWindow) {\n      throw new Error(\n        `Amendment rate limit exceeded: ${this.maxAmendmentsPerWindow} per ${this.amendmentWindowMs}ms`\n      );\n    }\n\n    const amendment: Amendment = {\n      id: randomUUID(),\n      timestamp: now,\n      status: 'proposed',\n      votes: new Map(),\n      ...proposal,\n    };\n\n    this.amendments.set(amendment.id, amendment);\n    return amendment;\n  }\n\n  /**\n   * Vote on an amendment","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/guidance/src/meta-governance.ts#L350-L386","documentation":"MetaGovernor.proposeAmendment() enforces an in-memory rate limit: it counts amendmentHistory entries newer than amendmentWindowMs and refuses new proposals once the count reaches maxAmendmentsPerWindow. History entries are pushed only by enactAmendment() and vetoAmendment(), so the limit throttles how many amendments you can carry to completion (or veto) inside the window. Defaults are 3 per 24 hours, configurable via MetaGovernanceConfig.","triggerScenarios":"Enacting or vetoing 3 amendments (default) and then proposing another within the 24h window; governance test suites that loop propose → vote → resolve → enact rapidly; tuning MetaGovernanceConfig { maxAmendmentsPerWindow, amendmentWindowMs } without accounting for batch runs.","commonSituations":"Automated governance pipelines or CI that replay many amendments; seeding a new governor by replaying an amendment backlog; default limits colliding with scripted demos.","solutions":["Wait for the window to elapse — history entries age out of the count based on their timestamp","For tests or batch replays, construct the governor with a higher maxAmendmentsPerWindow or a shorter amendmentWindowMs","Batch several rule changes into a single amendment's changes[] instead of proposing many small amendments","Remember the count is in-memory: a restart resets it (at the cost of losing pending amendment state)"],"exampleFix":"// before\nconst governor = createMetaGovernor(); // 3 per 24h\n// after (test/batch config)\nconst governor = createMetaGovernor({\n  maxAmendmentsPerWindow: 50,\n  amendmentWindowMs: 60_000,\n});","handlingStrategy":"retry","validationCode":"const windowStart = Date.now() - amendmentWindowMs;\nconst recent = governor.getAmendmentHistory().filter(a => a.timestamp > windowStart);\nif (recent.length >= maxAmendmentsPerWindow) {\n  // wait, batch into fewer amendments, or reconfigure the governor\n  throw new Error('Amendment budget exhausted for the window');\n}","typeGuard":null,"tryCatchPattern":"try {\n  governor.proposeAmendment(proposal);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Amendment rate limit exceeded')) {\n    // transient by design: schedule a retry after the window or fold changes into an existing amendment\n    return scheduleRetry(proposal, windowRemainingMs);\n  }\n  throw err;\n}","preventionTips":["Batch multiple rule changes into one amendment's changes[] array","Configure maxAmendmentsPerWindow / amendmentWindowMs explicitly for test and batch environments","Remember the throttle is in-memory and counts enacted/vetoed amendments, not mere proposals"],"tags":["guidance","meta-governance","amendment","rate-limit","throttling"],"backgroundTag":"rate-limit-exceeded","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}