Govern X (Twitter) account work through three lanes: evidence reads, typed act plans for posting and account hygiene, and gated execution with per-act provider evidence. Nothing reaches a live timeline or mutates an account without an explicit approval recorded in the receipt.
You’re reading version sha-0f6fa068a133. Go to the current version
Overview
One account, three lanes: read evidence, plan typed acts, execute an approved plan.
This is the public branded X (Twitter) catalog skill for the message-send action
family. Its core invariant: the agent may read, audit, draft, and plan freely,
but every act that publishes to a public timeline or mutates the account stops
at a human approval gate, and the sealed receipt proves which acts ran, against
which plan digest, with which provider evidence.
Write for the operator who owns the account, the reviewer who approves a live act, and downstream skills that consume the resulting packets. Keep each plan to the smallest evidence-backed act set that satisfies the objective. Existing post and user ids must come from supplied evidence, never memory or guesswork; name missing evidence as a blocker.
In the manual
Runners
executeplanreadread-archiveselect
Declared by its execution profile. Read the profile
SKILL.md
One account, three lanes: read evidence, plan typed acts, execute an approved plan.
This is the public branded X (Twitter) catalog skill for the message-send action
family. Its core invariant: the agent may read, audit, draft, and plan freely,
but every act that publishes to a public timeline or mutates the account stops
at a human approval gate, and the sealed receipt proves which acts ran, against
which plan digest, with which provider evidence.
Write for the operator who owns the account, the reviewer who approves a live act, and downstream skills that consume the resulting packets. Keep each plan to the smallest evidence-backed act set that satisfies the objective. Existing post and user ids must come from supplied evidence, never memory or guesswork; name missing evidence as a blocker.
What this skill does
Five runners:
read: collect account evidence from the live API through thetwitterconnector. Queries:snapshot,posts,mentions,search,following,followers. A query withoutparams.user_idreads the authenticated account; with it, another account. The connector reads whole pages until it has at leastmax_items, keeps every item of them, and reports innext_cursorwhere a further read starts (pass it back asparams.pagination_token). Emitstwitter.evidence.v1. Read-only; no gate.read-archive: inspect one contained X archive export (tweets.js,following.js, orfollower.js) through the runtime's digest-bound artifact page seam. Twitter code receives bounded, record-complete pages and never a path or whole-file escape hatch. The runtime snapshots up to 512 MiB and this skill requests 512 KiB pages; the page size is not a total archive limit. Emits the sametwitter.evidence.v1packet; no gate.plan: turn one bounded objective plus evidence intotwitter.plan.v1, an explicit list of typed acts with rationale, using agent judgment, then bind the exact plan through nativedata.digest. This is the curated lane, for dozens of acts that each deserve a reason. A plan is a draft; it delivers nothing. The result exposestwitter_plan.dataand the matchingdigest_result.data.digestrequired byexecute; callers never calculate the digest themselves.select: the bulk lane. Apply a deterministic predicate to an archive export and emit a compact plan, no agent judgment. Use it when the criterion is mechanical and the match set runs to thousands, where a per-item rationale would be wrong and would exceed the runtime output limit. Two targets:postspagestweets.jsand emitsdelete_postacts (predicate: author, date range, engagement threshold), with identical results across page sizes;usersreads a boundedfollowing.jsbundle and emitsunfollowacts (predicate:non_mutual: truefor accounts you follow that do not follow back, needingfollower.jstoo, or an explicituser_idslist). Emitstwitter.selection.v1carrying a digest-boundtwitter_plan.execute: run the next batch of an approved plan as onetwitterconnector operation behind its own approval, sealing per-act outcomes intotwitter.execution.v1and appending one compact progress fact to a durable execution ledger. A batch is one published act (a post, reply, quote, or one thread segment), or the contiguous run of up to 50 acts of one other kind from the cursor. The approval binds that exact call. The kernel records each act's outcome as it lands and stops sending at a rate limit, so a monotonic cursor, not an accumulated id list, is enough to resume safely.
Resume and the execution ledger
execute is stateless per turn; the state lives in a store stream keyed
by the immutable plan digest. The latest twitter.execution.progress.v1 event
contains only the X account id the batch ran as, next_act_index,
total_act_count, an optional in-progress thread segment cursor, and a bounded
summary of the last batch. Its size is constant whether the plan has completed
two acts or two thousand.
Each batch first reads the bound account. It runs only when that account is
the plan's principal (account:@handle, any letter case) and, once the ledger
has pinned an account id, the same account every earlier batch ran as;
otherwise the run fails before anything is sent. The approval shows the
verified @handle and account id.
The driver reads only the latest ledger event (read_events, limit: 1) and
its stream version. It calls execute with that expected_version and the
canonical key twitter:<plan_digest>:v<expected_version+1>. The runner performs
the same tail read itself and refuses stale or misbound inputs before approval
or provider work. After a committed batch, the driver repeats with the new
version until next_act_index == total_act_count. It never scans history or
folds completed ids. An invalid plan, digest mismatch, stale cursor, or already
complete plan produces a sealed refusal/no-op receipt but does not append a
fake state transition.
Threads use one extra bounded cursor: each segment is its own batch, and
progress records the next segment plus the confirmed reply id until the last
one posts, so a resumed thread never reposts a confirmed segment. The operator binds
data_source_ref to durable local SQLite or another store the store
connector reaches; the skill never opens the database directly.
Each runner emits exactly one packet for its lane: typed evidence with provenance and a content digest, a curated or bulk act plan bound by digest, or provider outcomes bound to the executed plan digest and appended to the ledger.
The act vocabulary, with its consequence class:
| kind | consequence | params |
|---|---|---|
post |
public_send | text |
reply |
public_send | text, in_reply_to |
quote |
public_send | text, quote_of |
thread |
public_send | texts (ordered, max 25) |
repost |
public_send | post_id |
delete_post |
live_mutation | post_id |
unfollow |
live_mutation | target_user_id |
mute |
live_mutation | target_user_id |
block |
live_mutation | target_user_id |
follow |
live_mutation | target_user_id |
like |
live_mutation | post_id |
Every kind is consequential, so every plan sets
gates.human_approval_required: true. follow, like, and repost are
engagement acts and share a hard cap of 10 per plan. Direct messages are
outside this skill.
A published act is confirmed by reading the post back. The other kinds are
acknowledged: X answers each with the resulting state (following: false,
deleted: true), which is the evidence, and has no read of one follow or like
cheap enough to confirm a batch. They set a state, so resending one changes
nothing. An answer that does not state the resulting state stops the cursor at
that act, and a later batch sends it again.
Post and reply text, and each thread segment, is a non-empty string of at
most 4000 characters, published verbatim; ids are X id strings. A plan that
breaks either is refused before approval.
When to use this skill
- Promote a release, publish a thread, or reply to a mention on behalf of a named principal, with content bound verbatim in the plan.
- Audit an account's own post history or following list and prune it: bulk delete old posts, unfollow low-value accounts, against operator-stated criteria.
- Gather timeline, mention, or search evidence for downstream research,
triage, or lead skills that consume
twitter.evidence.v1. - Route a
message-sendplan onto X as its provider delivery lane.
When not to use this skill
- To send direct messages or manage DM conversations.
- To farm engagement: follow-churn, mass liking, coordinated reposting, or any volume pattern designed to game visibility. The engagement cap is not a budget to fill.
- To mention, reply to, or dogpile users who have not engaged with the principal, at volume.
- To operate an account the operator does not control, or to automate consumer account creation.
- To bypass the approval gate, the act caps, or the operator's spending limit on the pay-per-use API.
Procedure
For the plan runner, build twitter_plan this way:
- Hold one bounded objective. If the ask bundles unrelated jobs (a promo
thread plus a follow purge), return
needs_inputwith the split. - Ground every reference. Ids for
delete_post,unfollow,reply,quote,like,mute, andblockmust come fromevidence_jsonor an explicit operator-supplied id. If the evidence is missing or stale, name it as a blocker; never invent or approximate an id. - Write public content into the act params verbatim: the exact
textortextsto publish, shaped bybrand_contextwhen supplied. Do not plan a summary of what will be written; approval binds the exact words. - Give every act a stable
act_id(act-001onward), itskind,params, itsconsequencefrom the table, and a one-linerationaletied to the objective or the operator's stated criteria. - Apply
operator_policynarrowly. A prune criterion like "no engagement and older than 2023" selects only posts the evidence shows meet it; borderline items go toopen_questions, not into the act list. - Keep the plan small: at most 50 acts, at most 10 engagement acts, threads at most 25 segments. A larger job becomes staged plans.
- Set
decision:readywhen acts are grounded and complete;needs_inputfor missing objective, principal, evidence, or content;rejectfor asks outside the vocabulary or inside the abuse boundaries. - Never place credentials, bearer tokens, raw API dumps, or third-party personal data beyond public ids and handles in the plan.
Edge cases and stop conditions
- Mixed objective: return
needs_inputwith the runner or plan split. - Id not in evidence: blocker; the plan stays
needs_input. - Prune criteria ambiguous: select the unambiguous items, list the rest in
open_questions. - Rate limit or provider refusal during read: the read fails with the provider's reason; a read is whole or it fails.
- Oversized user-selection archive: the current two-file
usersselector refuses when either bounded text file exceeds the native read limit; it never treats truncation as an empty following/follower set.read-archiveitself remains paged. Do not claim an oversized users bulk plan was evaluated. - Rate limit during execute: nothing more is sent; the acts before it are
settled and the packet reports
next_act_index,remaining_count, and the reset time. After the reset, read the latest ledger version and invoke the next canonical batch; do not reconstruct ids. - One act refused: a refused act is recorded as
failedwith the provider's reason and the cursor moves past it. Unfollowing a deactivated account is already the state the act asked for, so it counts as done. - Plan digest mismatch on execute: the apply step refuses and executes nothing. A refusal is receipt evidence, not a fake ledger transition.
- Stale stream version or batch key: refusal before the approval/provider boundary. Re-read the one-event ledger tail and derive the canonical key.
- Partially posted thread: resume from the ledger's
active_threadcursor; never restart the thread from its first confirmed segment. - Approval missing or denied: the execute graph stops at the gate.
- No bound account: admission refuses before any provider call; bind one
with
runx connector use twitter --credential user. - Fully autonomous live posting requested:
reject; the gate is the contract.
Output schema
twitter.evidence.v1:decision(okorneeds_input),source(liveorarchive),query,account,items[](typed post or user records with metrics),item_count,truncated,next_cursor(where the next live read starts, or null),provenance(retrieved_via, the readback reference of the provider answers or the archive artifact, andcontent_digest),blockers[].twitter.plan.v1(returned astwitter_plan.datatogether withdigest_result.data.digest):decision(ready,needs_input,reject),objective,principal,acts[](act_id,kind,params,consequence,rationale),gates(human_approval_required,approval_ref),evidence_refs[], optionalcontext_bindings[](packet_digest,applied_rules[]) preserving the exact brand or taste context applied by the planner,open_questions[],blockers[],success_checkpoint.twitter.selection.v1:decision,objective,principal,predicate,matched,scanned,truncated,twitter_plan(atwitter.plan.v1),plan_digest,blockers[]. Thetwitter_planis what a driver hands toexecute, andplan_digestis bound so the approved and executed bytes are provably identical.twitter.execution.v1:decision(executed,partial,stopped,refused,noop),plan_digest,principal,results[](act_id,kind,consequence,status,provider_ref,detail) for the current bounded batch,next_act_index,total_act_count,remaining_count, optionalactive_thread,rate,blockers[], andsuccess_checkpoint. A ready batch also carries the compacttwitter.execution.progress.v1ledger delta.
Worked example
Input: objective "delete my zero-engagement posts from before 2024",
principal account:@example, evidence from
read-archive(query: posts, archive_file: data/tweets.js) showing three matching
posts, operator_policy "keep anything with replies".
Output: decision: ready; three delete_post acts, each carrying the post id
from the evidence and a rationale quoting its age and zero metrics;
gates.human_approval_required: true; one borderline post with two replies
listed in open_questions. Execution then stops at the approval gate, and the
sealed receipt binds the approved digest to the three deletions the provider
confirmed.
Inputs
read:query(required),params(user_id,q,pagination_token),max_items.read-archive:queryand relativearchive_file(required),archive_base(workspacedefault, orskillfor packaged fixtures), andmax_items.plan:objective(required),principal(required),evidence_json,operator_policy,brand_context,operator_context.select:objective(required),principal(required),target(postsdefault, orusers),archive_file(posts),following_fileandfollowers_file(users),predicate(required: posts takert_of,is_retweet,text_prefix,text_contains,max_likes,max_reposts,before_year,after_year; users takenon_mutualoruser_ids),archive_base,max_acts.execute:plan_jsonandplan_digest(required),data_source_ref(required),expected_version(required),idempotency_key(required),max_acts(acts per batch, hard-capped at 50).idempotency_keymust be exactlytwitter:<plan_digest>:v<expected_version+1>; the runner independently verifies both values against the durable one-event tail before execution.
Credentials and cost
The twitter connector declares two credentials, and the bound account's
credential decides how a request authenticates. Credentials never appear as
inputs or receipt material.
user: one JSON object holdingconsumer_key,consumer_secret,access_token,access_secret(OAuth 1.0a user context). Required for every mutation and for the authenticated account's own reads. Bind it withrunx connector use twitter --credential user, the JSON on stdin.app: the app-context bearer token, enough forsearchand reads that name another account byuser_id. Bind it withrunx connector use twitter --credential app, the token on stdin.
The X API bills per request on current plans and a post containing a link
costs a large multiple of a plain one, so prefer archive exports for bulk
history, set a spending cap in the developer portal, and let max_items and
the act caps bound each run.
Agent task contract
twitter-plan
Follow the plan procedure and act vocabulary above. Return one
twitter_plan containing decision, objective, principal, typed acts,
approval gates, evidence refs, open questions, blockers, and a truthful success
checkpoint. Every referenced post or user id must be grounded in supplied
evidence, and every public word must appear verbatim in the act params. A plan
never executes, publishes, deletes, follows, or otherwise mutates the account.
Published execution profile
The execution profile published with sha-0f6fa068a133, shown as its exact bytes.
| Runners |
|
|---|---|
| Profile digest | sha256:fa4c3dce4a4d0d2842d9ba5f01851c553afac1984199ebf235c4850f3051d169 |
skill: twitter
version: "0.5.9"
catalog:
kind: skill
audience: public
visibility: public
role: branded
canonical_skill: runx/message-send
provider: twitter
execution: read
completion: provider_readback
approval: none
category: growth
harness:
files:
- fixtures/data/archive-follower.js
- fixtures/data/archive-following.js
- fixtures/data/archive-tweets.js
- fixtures/support/composed.graph
cases: []
connectors:
store:
operations: [events.append, events.read]
twitter:
operations: [account.snapshot, account.posts.read, account.mentions.read, account.following.read, account.followers.read, posts.read, mentions.read, following.read, followers.read, posts.search, post.create, post.reply, post.quote, posts.delete, users.unfollow, users.follow, users.mute, users.block, posts.like, posts.repost]
runners:
read:
default: true
inputs:
query:
type: string
required: true
description: "Evidence query kind: snapshot, posts, mentions, search, following, or followers."
schema: { enum: [snapshot, posts, mentions, search, following, followers] }
params:
type: object
required: false
description: "Query parameters: user_id (another account; the authenticated account when absent), q (search text), pagination_token (where an earlier read stopped)."
schema:
additionalProperties: false
properties:
user_id: { type: string, minLength: 1 }
q: { type: string, minLength: 1 }
pagination_token: { type: string, minLength: 1 }
max_items:
type: integer
required: false
default: 200
description: Items to read across pages. Pages are whole, so a read may return up to one page (99 items) more; next_cursor says where the next read starts.
schema: { minimum: 1, maximum: 10000 }
examples:
- query: snapshot
max_items: 200
result_from: [finalize, blocked]
steps:
- id: prepare
inputs:
query: "$input.query"
params: "$input.params"
source: live
max_items: "$input.max_items"
tool: { module: twitter-read.mjs, export: prepareRead }
outputs:
twitter_read_plan: object
- id: request
when:
value: $steps.prepare.twitter_read_plan.decision
equals: live
operation: twitter
operation_name: $steps.prepare.twitter_read_plan.connector_operation
input: $steps.prepare.twitter_read_plan.provider_input
- id: normalize
when:
value: $steps.prepare.twitter_read_plan.decision
equals: live
inputs:
read_plan: $steps.prepare.twitter_read_plan
provider_operation: $steps.request.provider_operation
tool: { module: twitter-read.mjs, export: normalizeRead }
outputs:
twitter_read_result: object
- id: digest
when:
value: $steps.prepare.twitter_read_plan.decision
equals: live
tool: data.digest
inputs:
value: $steps.normalize.twitter_read_result.items
- id: finalize
when:
value: $steps.prepare.twitter_read_plan.decision
equals: live
inputs:
read_result: $steps.normalize.twitter_read_result
digest_result: $steps.digest.digest_result
tool: { module: twitter-read.mjs, export: finalizeRead }
outputs:
twitter_evidence:
type: object
schema:
required: [decision, source, query, account, items, item_count, truncated, next_cursor, provenance, blockers]
additionalProperties: false
properties:
decision: { type: string, enum: [ok, needs_input] }
source: { type: string, enum: [live, archive] }
query:
type: object
required: [kind]
maxProperties: 2
properties:
kind: { type: string, enum: [snapshot, posts, mentions, search, following, followers] }
params: { type: object, maxProperties: 50 }
account: { type: [object, 'null'], maxProperties: 5 }
items:
type: array
maxItems: 10099
items:
oneOf:
- type: object
required: [id, text, created_at, metrics, has_link, in_reply_to]
additionalProperties: false
properties:
id: { type: [string, integer] }
text: { type: string }
created_at: { type: [string, 'null'] }
metrics:
type: object
required: [likes, reposts, replies, quotes, impressions]
additionalProperties: false
properties:
likes: { type: number }
reposts: { type: number }
replies: { type: [number, 'null'] }
quotes: { type: [number, 'null'] }
impressions: { type: [number, 'null'] }
has_link: { type: boolean }
in_reply_to: { type: [string, integer, 'null'] }
- type: object
required: [id, username, name, description, metrics]
additionalProperties: false
properties:
id: { type: [string, integer] }
username: { type: [string, 'null'] }
name: { type: [string, 'null'] }
description: { type: string }
metrics:
type: [object, 'null']
required: [followers, following, posts]
additionalProperties: false
properties:
followers: { type: number }
following: { type: number }
posts: { type: number }
item_count: { type: integer, minimum: 0, maximum: 10099 }
truncated: { type: boolean }
next_cursor: { type: [string, 'null'], minLength: 1, maxLength: 512 }
provenance:
type: object
required: [retrieved_via, content_digest]
additionalProperties: false
properties:
retrieved_via: { type: string, maxLength: 4000 }
content_digest: { type: string, pattern: '^sha256:[0-9a-f]{64}$' }
blockers: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
artifacts:
named_emits:
twitter_evidence: twitter_evidence
packets:
twitter_evidence: twitter.evidence.v1
- id: blocked
when:
value: $steps.prepare.twitter_read_plan.decision
not_equals: live
inputs:
read_plan: $steps.prepare.twitter_read_plan
tool: { module: twitter-read.mjs, export: blockedRead }
outputs:
twitter_evidence: object
artifacts:
named_emits:
twitter_evidence: twitter_evidence
packets:
twitter_evidence: twitter.evidence.v1
read-archive:
inputs:
query:
type: string
required: true
description: "Archive query kind: posts, following, or followers."
schema: { enum: [posts, following, followers] }
archive_file:
type: string
required: true
description: Relative path to an X archive export file.
archive_base:
type: string
required: false
default: workspace
description: "Archive path base: workspace or skill."
schema: { enum: [workspace, skill] }
max_items:
type: integer
required: false
default: 200
description: Maximum items returned from the archive.
schema: { minimum: 1, maximum: 10000 }
examples:
- query: posts
archive_file: fixtures/data/archive-tweets.js
archive_base: skill
max_items: 10
result_from: [finalize]
steps:
- id: prepare
inputs:
query: "$input.query"
archive_file: "$input.archive_file"
source: archive
max_items: "$input.max_items"
tool: { module: twitter-read.mjs, export: prepareRead }
outputs:
twitter_read_plan: object
- id: normalize
scopes:
- fs.read
inputs:
archive_file: "$input.archive_file"
archive_base: "$input.archive_base"
read_plan: $steps.prepare.twitter_read_plan
tool: { module: twitter-read.mjs, export: normalizeArchivePage, pages: { path_from: archive_file, path_scope_from: archive_base, media_type: application/javascript, framing: json_array, page_bytes: 524288 } }
outputs:
twitter_read_result: object
- id: digest
tool: data.digest
inputs:
value: $steps.normalize.twitter_read_result.items
- id: finalize
inputs:
read_result: $steps.normalize.twitter_read_result
digest_result: $steps.digest.digest_result
tool: { module: twitter-read.mjs, export: finalizeRead }
outputs:
twitter_evidence: object
artifacts:
named_emits:
twitter_evidence: twitter_evidence
packets:
twitter_evidence: twitter.evidence.v1
plan:
inputs:
objective:
type: string
required: true
description: One bounded objective for this plan.
principal:
type: string
required: true
description: The account being operated, for example account:@handle.
evidence_json:
type: object
required: false
description: A twitter.evidence.v1 packet (or excerpt) grounding the plan; required for any act that references existing posts or users.
schema:
properties:
source: { type: string, enum: [live, archive] }
query:
type: object
required: [kind]
properties:
kind: { type: string, enum: [snapshot, posts, mentions, search, following, followers] }
params: { type: object, maxProperties: 50, additionalProperties: true }
additionalProperties: false
items:
type: array
maxItems: 10099
items: { type: object, additionalProperties: true }
item_count: { type: integer, minimum: 0, maximum: 10099 }
additionalProperties: true
operator_policy:
type: string
required: false
description: Operator constraints such as prune criteria, posting cadence, or content boundaries.
brand_context:
type: object
required: false
description: Brand-voice or taste-profile packet excerpt for public content.
schema:
properties:
schema: { type: string, minLength: 1, maxLength: 256 }
data: { type: object, additionalProperties: true }
additionalProperties: true
operator_context:
type: string
required: false
description: Extra operator guardrails.
examples:
- objective: Delete zero-engagement posts from before 2019.
principal: account:@example
evidence_json:
source: archive
query: { kind: posts }
items:
- id: '1001'
text: Old test post
created_at: Mon Apr 03 14:00:00 +0000 2017
metrics: { likes: 0, reposts: 0 }
operator_policy: Keep anything with likes or reposts.
result_from: [draft, digest]
steps:
- id: draft
inputs:
objective: "$input.objective"
principal: "$input.principal"
evidence_json: "$input.evidence_json"
operator_policy: "$input.operator_policy"
brand_context: "$input.brand_context"
operator_context: "$input.operator_context"
agent: { role: builder, task: twitter-plan }
outputs:
twitter_plan:
type: object
schema:
required: [decision, objective, principal, acts, gates, evidence_refs, open_questions, blockers, success_checkpoint]
additionalProperties: false
properties:
decision: { type: string, enum: [ready, needs_input, reject] }
objective: { type: string, minLength: 1, maxLength: 4000 }
principal: { type: string, minLength: 1, maxLength: 512 }
acts:
type: array
maxItems: 50
items:
type: object
required: [act_id, kind, params, consequence, rationale]
additionalProperties: false
properties:
act_id: { type: string, pattern: '^act-[A-Za-z0-9._:-]+$' }
kind: { type: string, enum: [post, reply, quote, thread, delete_post, unfollow, follow, mute, block, like, repost] }
params: { type: object, minProperties: 1, additionalProperties: true }
consequence: { type: string, minLength: 1, maxLength: 256 }
rationale: { type: string, minLength: 1, maxLength: 4000 }
gates:
type: object
required: [human_approval_required, approval_ref]
additionalProperties: false
properties:
human_approval_required: { const: true }
approval_ref: { type: [string, 'null'] }
evidence_refs:
type: array
maxItems: 100
items: { type: string, minLength: 1, maxLength: 2048 }
context_bindings:
type: array
maxItems: 20
items:
type: object
required: [packet_digest, applied_rules]
additionalProperties: false
properties:
packet_digest: { type: string, pattern: '^sha256:[0-9a-f]{64}$' }
applied_rules:
type: array
maxItems: 100
items: { type: string, minLength: 1, maxLength: 4000 }
open_questions:
type: array
maxItems: 100
items: { type: string, minLength: 1, maxLength: 4000 }
blockers:
type: array
maxItems: 100
items: { type: string, minLength: 1, maxLength: 4000 }
success_checkpoint:
type: object
required: [milestone, description]
additionalProperties: false
properties:
milestone: { type: string, minLength: 1, maxLength: 256 }
description: { type: string, minLength: 1, maxLength: 4000 }
artifacts:
named_emits: { twitter_plan: twitter_plan }
packets: { twitter_plan: twitter.plan.v1 }
- id: digest
tool: data.digest
inputs:
value: $steps.draft.twitter_plan
select:
inputs:
objective:
type: string
required: true
description: One bounded objective for this bulk selection.
principal:
type: string
required: true
description: The account being operated, for example account:@handle.
target:
type: string
required: false
default: posts
description: "What the selection operates over: posts (tweets.js, delete) or users (following.js, unfollow)."
schema: { enum: [posts, users] }
archive_file:
type: string
required: false
description: Path to an X tweets.js archive export; required for target posts.
archive_base:
type: string
required: false
default: workspace
description: "Archive path base: workspace or skill."
schema: { enum: [workspace, skill] }
following_file:
type: string
required: false
description: Path to an X following.js archive export; required for target users.
followers_file:
type: string
required: false
description: Path to an X follower.js archive export; required for the non_mutual predicate.
predicate:
type: object
required: true
description: "Typed selection predicate. Posts: rt_of, is_retweet, text_prefix, text_contains, max_likes, max_reposts, before_year, after_year. Users: non_mutual (true), user_ids. Every supplied field must match."
schema:
minProperties: 1
additionalProperties: false
properties:
rt_of: { type: string, minLength: 1 }
is_retweet: { type: boolean }
text_prefix: { type: string, minLength: 1 }
text_contains: { type: string, minLength: 1 }
max_likes: { type: integer, minimum: 0 }
max_reposts: { type: integer, minimum: 0 }
before_year: { type: integer, minimum: 2006, maximum: 9999 }
after_year: { type: integer, minimum: 2006, maximum: 9999 }
non_mutual: { const: true }
user_ids:
type: array
minItems: 1
uniqueItems: true
items: { type: string, minLength: 1 }
max_acts:
type: integer
required: false
default: 5000
description: Cap on selected acts; a larger match set is flagged truncated.
schema: { minimum: 1 }
examples:
- objective: Delete all reposts of the BetaList account.
principal: account:@example
target: posts
archive_file: fixtures/data/archive-tweets.js
archive_base: skill
predicate: { is_retweet: true, rt_of: BetaList }
max_acts: 5000
result_from: [finalize-posts, finalize-users]
steps:
- id: prepare
inputs:
target: "$input.target"
archive_file: "$input.archive_file"
following_file: "$input.following_file"
followers_file: "$input.followers_file"
predicate: "$input.predicate"
tool: { module: twitter-selection.mjs, export: prepareSelection }
outputs:
twitter_selection_plan: object
- id: read-users
tool: fs.read_bundle
scopes:
- fs.read
when:
value: $steps.prepare.twitter_selection_plan.target
equals: users
inputs:
path_scope: "$input.archive_base"
paths: $steps.prepare.twitter_selection_plan.paths
- id: select-posts
scopes:
- fs.read
inputs:
objective: "$input.objective"
principal: "$input.principal"
predicate: "$input.predicate"
max_acts: "$input.max_acts"
archive_file: "$input.archive_file"
archive_base: "$input.archive_base"
selection_plan: $steps.prepare.twitter_selection_plan
target: $input.target
following_file: $input.following_file
followers_file: $input.followers_file
when:
value: $steps.prepare.twitter_selection_plan.target
equals: posts
tool: { module: twitter-selection.mjs, export: selectArchivePage, pages: { path_from: archive_file, path_scope_from: archive_base, media_type: application/javascript, framing: json_array, page_bytes: 524288 } }
outputs:
twitter_selection_draft: object
- id: select-users
inputs:
objective: "$input.objective"
principal: "$input.principal"
predicate: "$input.predicate"
max_acts: "$input.max_acts"
selection_plan: $steps.prepare.twitter_selection_plan
file_read_bundle: $steps.read-users.file_read_bundle
target: $input.target
archive_file: $input.archive_file
archive_base: $input.archive_base
following_file: $input.following_file
followers_file: $input.followers_file
when:
value: $steps.prepare.twitter_selection_plan.target
equals: users
tool: { module: twitter-selection.mjs, export: selectUsersArchive }
outputs:
twitter_selection_draft: object
- id: digest-posts
tool: data.digest
when:
value: $steps.prepare.twitter_selection_plan.target
equals: posts
inputs:
value: $steps.select-posts.twitter_selection_draft.twitter_plan
- id: finalize-posts
when:
value: $steps.prepare.twitter_selection_plan.target
equals: posts
inputs:
twitter_selection_draft: $steps.select-posts.twitter_selection_draft
digest_result: $steps.digest-posts.digest_result
tool: { module: twitter-selection.mjs, export: bindSelectionDigest }
outputs:
twitter_selection:
type: object
schema:
required: [decision, objective, principal, source, predicate, matched, scanned, truncated, twitter_plan, plan_digest, blockers]
additionalProperties: false
properties:
decision: { type: string, enum: [ready, needs_input] }
objective: { type: string, maxLength: 10000 }
principal: { type: string, maxLength: 1000 }
source: { type: string, enum: [archive, users_archive] }
predicate: { type: object, minProperties: 1, maxProperties: 10 }
matched: { type: integer, minimum: 0 }
scanned: { type: integer, minimum: 0 }
truncated: { type: boolean }
twitter_plan:
type: [object, 'null']
required: [decision, objective, principal, acts, gates, evidence_refs, open_questions, blockers, success_checkpoint]
additionalProperties: false
properties:
decision: { const: ready }
objective: { type: string, minLength: 1, maxLength: 10000 }
principal: { type: string, minLength: 1, maxLength: 1000 }
acts:
type: array
maxItems: 5000
items:
type: object
required: [act_id, kind, params, consequence, rationale]
additionalProperties: false
properties:
act_id: { type: string, pattern: '^act-[A-Za-z0-9._:-]+$' }
kind: { type: string, enum: [delete_post, unfollow] }
params: { type: object, minProperties: 1, maxProperties: 5 }
consequence: { const: live_mutation }
rationale: { type: string, minLength: 1, maxLength: 4000 }
gates:
type: object
required: [human_approval_required, approval_ref]
additionalProperties: false
properties:
human_approval_required: { const: true }
approval_ref: { const: 'approval:pending' }
evidence_refs: { type: array, maxItems: 10, items: { type: string, minLength: 1, maxLength: 4000 } }
open_questions: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
blockers: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
success_checkpoint:
type: object
required: [milestone, description]
additionalProperties: false
properties:
milestone: { const: bulk_plan_ready_for_approval }
description: { type: string, minLength: 1, maxLength: 4000 }
plan_digest: { type: string, pattern: '^(?:sha256:[0-9a-f]{64})?$' }
blockers: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
artifacts:
named_emits:
twitter_selection: twitter_selection
packets:
twitter_selection: twitter.selection.v1
- id: digest-users
tool: data.digest
when:
value: $steps.prepare.twitter_selection_plan.target
equals: users
inputs:
value: $steps.select-users.twitter_selection_draft.twitter_plan
- id: finalize-users
when:
value: $steps.prepare.twitter_selection_plan.target
equals: users
inputs:
twitter_selection_draft: $steps.select-users.twitter_selection_draft
digest_result: $steps.digest-users.digest_result
tool: { module: twitter-selection.mjs, export: bindSelectionDigest }
outputs:
twitter_selection: object
artifacts:
named_emits:
twitter_selection: twitter_selection
packets:
twitter_selection: twitter.selection.v1
execute:
inputs:
plan_json:
type: object
required: true
description: The twitter.plan.v1 object to execute.
schema:
required: [decision, principal, acts, gates]
additionalProperties: false
properties:
decision: { type: string, enum: [ready, needs_input, reject, refused] }
objective: { type: string, minLength: 1, maxLength: 4000 }
principal: { type: string, minLength: 1, maxLength: 512 }
acts:
type: array
maxItems: 5000
items:
type: object
required: [act_id, kind, params, consequence, rationale]
additionalProperties: false
properties:
act_id: { type: string, pattern: '^act-[A-Za-z0-9._:-]+$' }
kind: { type: string, enum: [post, reply, quote, thread, delete_post, unfollow, follow, mute, block, like, repost] }
params: { type: object, minProperties: 1, additionalProperties: true }
consequence: { type: string, minLength: 1, maxLength: 256 }
rationale: { type: string, minLength: 1, maxLength: 4000 }
gates:
type: object
required: [human_approval_required]
properties:
human_approval_required: { const: true }
approval_ref: { type: [string, 'null'] }
additionalProperties: false
evidence_refs: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 2048 } }
context_bindings:
type: array
maxItems: 20
items:
type: object
required: [packet_digest, applied_rules]
additionalProperties: false
properties:
packet_digest: { type: string, pattern: '^sha256:[0-9a-f]{64}$' }
applied_rules: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
open_questions: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
blockers: { type: array, maxItems: 100, items: { type: string, minLength: 1, maxLength: 4000 } }
success_checkpoint:
type: object
required: [milestone, description]
additionalProperties: false
properties:
milestone: { type: string, minLength: 1, maxLength: 256 }
description: { type: string, minLength: 1, maxLength: 4000 }
plan_digest:
type: string
required: true
description: Expected canonical digest of plan_json; a mismatch is a hard failure.
max_acts:
type: integer
required: false
default: 50
description: Acts one batch may take; a batch is one published act or a run of up to 50 acts of one kind.
schema: { minimum: 1, maximum: 50 }
data_source_ref:
type: string
required: true
description: Logical data source holding the execution ledger; the operator binds it to durable local SQLite.
expected_version:
type: integer
required: true
description: Current durable stream version. The runner independently reads and verifies it before any provider call.
schema: { minimum: 0 }
idempotency_key:
type: string
required: true
description: Canonical retry key twitter:<plan_digest>:v<expected_version+1>; mismatches fail before approval.
examples:
- plan_json:
decision: refused
objective: Delete one post.
principal: account:@example
acts:
- act_id: act-refused-1
kind: delete_post
params: { post_id: '1001' }
consequence: live_mutation
rationale: This refusal example never reaches the provider.
gates: { human_approval_required: true, approval_ref: approval:granted }
plan_digest: sha256:25cd0a74139936a7cad4124f4ef510f7b16aaaa49abced92f39f4fc5c7cfbfc6
max_acts: 50
data_source_ref: tenant://twitter/refused-plan
expected_version: 0
idempotency_key: twitter:sha256:25cd0a74139936a7cad4124f4ef510f7b16aaaa49abced92f39f4fc5c7cfbfc6:v1
result_from: [apply, apply_noop, persist]
steps:
- id: ledger
operation: store/events.read
input:
data_source_ref: "$input.data_source_ref"
resource: twitter_execution
aggregate_id: "$input.plan_digest"
limit: 1
- id: digest
tool: data.digest
inputs:
value: "$input.plan_json"
- id: prepare
inputs:
plan_json: "$input.plan_json"
plan_digest: "$input.plan_digest"
expected_version: "$input.expected_version"
idempotency_key: "$input.idempotency_key"
max_acts: "$input.max_acts"
digest_result: $steps.digest.digest_result
execution_ledger: $steps.ledger.provider_operation.result
tool: { module: twitter-execution.mjs, export: prepareExecution }
outputs:
twitter_execution_plan: object
- id: self
when:
value: $steps.prepare.twitter_execution_plan.decision
equals: ready
operation: twitter/account.snapshot
result_fields: [account]
input: {}
- id: bind
when:
value: $steps.prepare.twitter_execution_plan.decision
equals: ready
inputs:
execution_plan: $steps.prepare.twitter_execution_plan
account: $steps.self.provider_operation.result.account
tool: { module: twitter-execution.mjs, export: bindExecution }
outputs:
twitter_call: object
- id: request
when:
value: $steps.prepare.twitter_execution_plan.decision
equals: ready
operation: twitter
idempotency_key: "$input.idempotency_key"
operation_name: $steps.bind.twitter_call.operation
input: $steps.bind.twitter_call.input
approval: $steps.bind.twitter_call.approval
act:
purpose: Execute one approved twitter act plan, batch by batch, and nothing beyond it.
- id: apply
when:
value: $steps.prepare.twitter_execution_plan.decision
equals: ready
inputs:
execution_plan: $steps.prepare.twitter_execution_plan
provider_operation: $steps.request.provider_operation
account_id: $steps.bind.twitter_call.account_id
tool: { module: twitter-execution-result.mjs, export: finalizeExecution }
outputs:
twitter_execution:
type: object
schema:
required: [decision, plan_digest, principal, next_act_index, total_act_count, remaining_count, active_thread, results, ledger_delta, rate, blockers, success_checkpoint]
additionalProperties: false
properties:
decision: { type: string, enum: [executed, partial, stopped, refused, noop] }
plan_digest: { type: string, pattern: '^sha256:[0-9a-f]{64}$' }
principal: { type: [string, 'null'], maxLength: 1000 }
next_act_index: { type: integer, minimum: 0 }
total_act_count: { type: integer, minimum: 0 }
remaining_count: { type: integer, minimum: 0 }
active_thread:
type: [object, 'null']
required: [act_index, next_segment_index, in_reply_to]
additionalProperties: false
properties:
act_index: { type: integer, minimum: 0 }
next_segment_index: { type: integer, minimum: 1 }
in_reply_to: { type: string, minLength: 1, maxLength: 1000 }
results:
type: array
maxItems: 50
items:
type: object
required: [act_id, kind, consequence, status, provider_ref, detail]
additionalProperties: false
properties:
act_id: { type: string, minLength: 1, maxLength: 1000 }
kind: { type: string, minLength: 1, maxLength: 100 }
consequence: { type: string, minLength: 1, maxLength: 100 }
status: { type: string, enum: [done, failed] }
provider_ref: { type: [string, 'null'], maxLength: 4000 }
detail: { type: [string, 'null'], maxLength: 4000 }
ledger_delta:
type: [object, 'null']
required: [schema, type, plan_digest, account_id, decision, next_act_index, total_act_count, active_thread, batch]
additionalProperties: false
properties:
schema: { const: twitter.execution.progress.v1 }
type: { const: twitter.execution.progress }
plan_digest: { type: string, pattern: '^sha256:[0-9a-f]{64}$' }
account_id: { type: string, pattern: '^[0-9]{1,19}$' }
decision: { type: string, enum: [executed, partial, stopped] }
next_act_index: { type: integer, minimum: 0 }
total_act_count: { type: integer, minimum: 0 }
active_thread: { type: [object, 'null'], maxProperties: 3 }
batch:
type: object
required: [start_act_index, selected_act_count, completed_act_count, failed, rate_limited]
additionalProperties: false
properties:
start_act_index: { type: integer, minimum: 0 }
selected_act_count: { type: integer, minimum: 0, maximum: 50 }
completed_act_count: { type: integer, minimum: 0, maximum: 50 }
failed: { type: boolean }
rate_limited: { type: boolean }
rate:
type: object
required: [limited, remaining, reset_at]
additionalProperties: false
properties:
limited: { type: boolean }
remaining: { type: number }
reset_at: { type: [string, 'null'] }
blockers: { type: array, maxItems: 250, items: { type: string, minLength: 1, maxLength: 4000 } }
success_checkpoint:
type: object
required: [milestone, description]
additionalProperties: false
properties:
milestone: { type: string, enum: [plan_fully_executed, plan_partially_executed, plan_refused] }
description: { type: string, minLength: 1, maxLength: 4000 }
artifacts:
named_emits:
twitter_execution: twitter_execution
packets:
twitter_execution: twitter.execution.v1
- id: apply_noop
when:
value: $steps.prepare.twitter_execution_plan.decision
not_equals: ready
inputs:
execution_plan: $steps.prepare.twitter_execution_plan
tool: { module: twitter-execution-result.mjs, export: finalizeExecution }
outputs:
twitter_execution: object
artifacts:
named_emits:
twitter_execution: twitter_execution
packets:
twitter_execution: twitter.execution.v1
- id: persist
operation: store/events.append
idempotency_key: $steps.prepare.twitter_execution_plan.idempotency_key
when:
value: $steps.prepare.twitter_execution_plan.decision
equals: ready
input:
data_source_ref: "$input.data_source_ref"
resource: twitter_execution
aggregate_id: $steps.prepare.twitter_execution_plan.plan_digest
expected_version: $steps.prepare.twitter_execution_plan.expected_version
event: $steps.apply.twitter_execution.ledger_delta
Published package and test evidence.
This exact version passed its recorded harness run: 13 checks passed · 0 failed.
Test result
| Harness result | Passed |
|---|---|
| Tested version | sha-0f6fa068a133 |
| Recorded result | 13 checks passed · 0 failed |
| Result source | Reported by the publisher (runx_registry_publish) |
| Suite | runx-harness |
| Test recorded | |
| Test record | Open the recorded run |
Inspect receipt references
sha256:4209f242fcf37ccea38cd44bfaad553f67425a27c49a83fcc3224bb67fd04541sha256:f453673ec4304d6630cedc7f444d986e36b8214757c723a1ac0349a24df07b43sha256:32b480296e1823b38e6a9034cecca399567391086dd2f8febe6753122e039e93sha256:19cc76614cd8d063f67d6ec9d590c8bff8cf31f2929ed91044fb73a65a5f77easha256:e137ab51af8a7753460039c23dcd672761711c897ef95cfe90d29c09a1d00231sha256:39d55ad7427d80b8ec3e8d673ec203ef4a7c18df7d7784003d52d841ff2c8dc0sha256:55278f16bafb00071bc1e371cc19aa996da955f90dd9a3d8cbf60a03e4a202f8sha256:1b0ac6e36cf61a1237704d11c92cf12eee9c397d98026bd354f6db00c750ba91sha256:888c2c2d19b082aa467fd7fcd88226b1276ca5d6b74838957722566f8009d487sha256:6ae7cac7624be11a837998530f7c9afafd22b5663db371a50e0f4c26fc8e03f1sha256:e2eba62c3ba7501b2167fd2a352640caa7329e095fcd41484e036bfccdc6a6f1sha256:4c7f8bc1e198a9f7fafac482813b457bd7878a436840d7dee7c13e1aeb999477sha256:ed84cc89f9efbf22fc2eeeaf634f01f475ed8b188d8573e6dd0eca9679879189Package identity
| Published revision | sha-0f6fa068a133 |
|---|---|
| Content digest | sha256:0f6fa068a1333bb153842976cd15a3fd49f6efce69290d60a4ca5da2293ecdcd |
| SKILL.md digest | sha256:aa78eb16d5f39304172319d4130affeba61c1e5bce7b573f615860541d43cb00 |
| Execution profile digest | sha256:fa4c3dce4a4d0d2842d9ba5f01851c553afac1984199ebf235c4850f3051d169 |
| Publisher identity | Verified publisher · runx |
| Trust tier | Verified publisherRunx has verified this publisher. This tier is not a code assessment. |
| Attestations |
|
| Source provenance | Not published with this version |
Version history
0.5.11Content digest sha256:6776b73b9de3532385007515b933d044db1e1be622cf90e4b6104496445de41fsha-9392187a78ccContent digest sha256:9392187a78ccb97c1747e613bcd53ab9102f2e80628aa8cae5df10681b7b5af7sha-0f6fa068a133ViewingContent digest sha256:0f6fa068a1333bb153842976cd15a3fd49f6efce69290d60a4ca5da2293ecdcdsha-43f7b19bd360Content digest sha256:d7d764126daffe340ca8007c0be2be76925223266479b80f0e2f14858dc01841