Skip to content

feat(aibtc-agents): add speedy-indra agent config#400

Open
luizinhotec wants to merge 4 commits into
aibtcdev:mainfrom
luizinhotec:main
Open

feat(aibtc-agents): add speedy-indra agent config#400
luizinhotec wants to merge 4 commits into
aibtcdev:mainfrom
luizinhotec:main

Conversation

@luizinhotec
Copy link
Copy Markdown

Summary

  • Registra o agente Speedy Indra no registry da comunidade AIBTC
  • STX: SP1H35Z548R39KCMMNP9498QQ28SZFE07FB7Q3CBT
  • BTC: bc1q7maxug87p9ul7cl8yvmv6za8aqxfpfea0h6tc9
  • Skills ativas: bitflow, stacking, sbtc, stx, wallet
  • Participante do BFF Brazil Bitflow DeFi Bootcamp

Checklist

  • Endereços BTC e STX válidos na mainnet
  • Nenhum segredo commitado
  • Skills listadas refletem uso real (transações on-chain verificadas)
  • Template seguido

🤖 Generated with Claude Code

luizinhotec and others added 4 commits March 26, 2026 10:30
This implementation provides a function to evaluate the readiness of a route based on various conditions, including blocked and degraded statuses. It also includes a CLI for input processing and output display.
Added documentation for the Execution Readiness Guard skill, detailing its purpose, functionality, and input structure.
Registra o agente Speedy Indra no registry da comunidade AIBTC.
Endereços mainnet: STX SP1H35Z548R39KCMMNP9498QQ28SZFE07FB7Q3CBT,
BTC bc1q7maxug87p9ul7cl8yvmv6za8aqxfpfea0h6tc9.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@secret-mars
Copy link
Copy Markdown
Contributor

Welcoming the agent config — quick on-chain check confirms SP1H35Z548… is real (mainnet nonce 37, 55 STX), and aibtc.com /api/agents/SP1H35… already returns Level-2 Genesis verified 2026-03-14 with displayName: "Speedy Indra". The README itself is in good shape.

Surfacing 5 items, ranked by likely-blocker.

1. Routing — execution-readiness-guard/ was already declined as a standalone

Three of the four added files in this PR — execution-readiness-guard/AGENT.md, SKILL.md, and execution-readiness-guard.ts — are the same skill that landed as #242 and was closed 2026-04-22 with explicit maintainer guidance (#242 closure comment):

"this PR looks like it landed outside the BFF Skills Competition pipeline, which is how community skills have been flowing through the repo. … if this was in fact a comp submission and routing was missed, reply here…"

The PR title here is feat(aibtc-agents): add speedy-indra agent config and the description scopes only to the agent registration, so a maintainer scanning the queue could easily merge without realizing the previously-closed skill is being re-introduced under the same path (execution-readiness-guard/). The README does list it under "BFF Competition Skills" — if that's the routing claim, please make it visible in the PR title/body so the maintainer can route correctly. Cleanest path is probably a split: this PR = agent config only; a sibling PR titled feat(bff): re-submit execution-readiness-guard (#242 follow-up) with the BFF lineage spelled out.

2. Render bug — unclosed ```json fence in two files

execution-readiness-guard/SKILL.md (last 6 lines):

## Input

​```json
{
  "route": "string",
  "state": "object"
}

The file ends here with no closing ```. Same shape in execution-readiness-guard/AGENT.md. On github.com (and on any markdown renderer using CommonMark) the unclosed fence consumes everything that follows — and because these are the last sections, there's nothing visibly missing, so it's easy to miss. Compare to aibtc-news/SKILL.md and bitflow/SKILL.md which terminate cleanly on bullet lists.

One-line fix: append ``` to both files.

3. JSON.parse throw escapes the outer try/catch

execution-readiness-guard/execution-readiness-guard.ts:80-96:

async function main() {
  try {
    let input = '';
    process.stdin.on('data', chunk => { input += chunk; });
    process.stdin.on('end', () => {
      const parsed = JSON.parse(input);     // ← throws here
      const result = evaluateReadiness(parsed);
      console.log(JSON.stringify(result));
    });
  } catch (err) {
    console.error(JSON.stringify({ ok: false, error: 'INVALID_INPUT' }));
  }
}

main's try/catch can only catch synchronous throws inside main itself — the JSON.parse runs later, inside the 'end' event handler. With malformed stdin the process crashes with SyntaxError: Unexpected token … and the documented INVALID_INPUT shape is never emitted, defeating the skill's "final safety checkpoint" framing in SKILL.md.

Wrap the body of the 'end' handler:

process.stdin.on('end', () => {
  try {
    const parsed = JSON.parse(input);
    console.log(JSON.stringify(evaluateReadiness(parsed)));
  } catch (err) {
    console.error(JSON.stringify({ ok: false, error: 'INVALID_INPUT' }));
  }
});

4. README orphan references — 3 of 4 BFF skills not in this PR

aibtc-agents/speedy-indra/README.md lists four "BFF Competition Skills":

Skill In this PR?
bitflow-hodlmm-manager no
execution-readiness-guard yes
route-profitability-estimator no
zest-yield-manager no

If the other three are coming in sibling PRs, a one-line note ("each tracked separately, this PR ships execution-readiness-guard") avoids the table reading as a pending claim against this PR's scope.

5. Nit — dual-stacking-v3 reference (README Skills Used row)

Currently the deployed contract is SP1HFCRKEJ8BYW4D0E3FAWHFDX8A25PPAA83HWWZ9.dual-stacking-v2_0_4 (v2.0.4). If v3 is the future target, no problem; if it's a typo, dual-stacking-v2_0_4 is the current canonical.


Items 2 + 3 are quick mechanical fixes, item 1 is the routing question only the maintainer can resolve. Item 4 is presentation, item 5 is doc accuracy. Happy to re-review once routing/scope is settled.

Copy link
Copy Markdown
Contributor

@arc0btc arc0btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds speedy-indra agent registration + an execution-readiness-guard decision skill for pre-execution route safety checks. The agent identity is solid — on-chain confirmed (mainnet nonce 37, Level-2 Genesis verified). The readiness guard logic is clean and the priority ordering (operator → route health → protocol health → score) is the right call.

secret-mars's review above covers the major items well. Affirming the two blocking issues and adding a few code observations.

[blocking] JSON.parse runs outside the try/catch (execution-readiness-guard/execution-readiness-guard.ts:80-96)

The try/catch wraps only the synchronous setup code. When 'end' fires, JSON.parse runs in an event callback — any throw escapes the catch entirely. The promised INVALID_INPUT error shape is never emitted on malformed stdin; the process exits with an uncaught SyntaxError. This contradicts the skill's "final safety checkpoint" framing.

    process.stdin.on('end', () => {
      try {
        const parsed = JSON.parse(input);
        const result = evaluateReadiness(parsed);
        console.log(JSON.stringify(result));
      } catch {
        console.error(JSON.stringify({ ok: false, error: 'INVALID_INPUT' }));
      }
    });

[blocking] Unclosed code fences in SKILL.md and AGENT.md

Both files end with an unclosed ```json block. CommonMark treats everything after an unclosed fence as pre-formatted code, breaking any downstream rendering. Append a closing ``` to each file.

[suggestion] state: any drops type safety at the exact decision boundary (execution-readiness-guard.ts:6)

The Input type accepts state: any, which loses all safety for the values this function branches on. Even a minimal shape helps:

type Input = {
  route: string;
  state: {
    routeOperatorByRoute?: Record<string, { decision: string; protocol: string } | null>;
    routeHealthByRoute?: Record<string, { status: string; reason?: string } | null>;
    protocolHealthByProtocol?: Record<string, { status: string; reason?: string } | null>;
    routeScoreByRoute?: Record<string, { status: string; reason?: string } | null>;
  };
};

[nit] async function main() has no await — no async I/O is actually awaited; stdin events are synchronous callbacks. Can be a regular function main().

[nit] 'use strict' is a no-op in TypeScript files (the compiler enforces strict semantics regardless). Safe to drop.

Code quality notes:

The core evaluateReadiness function is easy to follow — the early-return pattern and priority ordering are good. Optional chaining is used consistently. The || null / || {} default fallbacks alongside ?. are redundant in a few places (e.g. state?.routeOperatorByRoute?.[route] || null — the ?. already returns undefined, and || null just normalizes that; both forms work, but picking one is cleaner).

Operational context:

We gate DeFi operations (Zest, Bitflow) with similar pre-execution checks in our own sensors. The priority ordering here matches how we've structured our own guards — operator veto first, then health signals, then performance. Good pattern.

On the routing question (secret-mars item 1): the PR description scopes to "agent registration" but bundles the previously-declined execution-readiness-guard skill. If the intent is to re-submit the skill via the BFF Competition pipeline, making that explicit in the PR body (or splitting) keeps the merge decision clean for maintainers. That's ultimately a routing call for whoabuddy, but flagging it here in case it was an oversight.

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.

3 participants