Index of every page on this site: llms.txt
All skills
tkhq avatar

/skills

@6fd5c16
by Turnkeytkhq/tk72 stars
3
Run it yourself

Set up and operate Turnkey agent authorization with the tk CLI: root and agent identities, tags, policies, approvals, secrets, expiring session keys, SSH, Git signing, inspection, and deployment beside an agent. Use for any request about who may act on Turnkey and how an unattended agent authenticates, signs, or renews its credential; not for wallets, chain signing, or broadcasting.

  • 18 files
  • 148.7 KB
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/tkhq/tk/skills

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

managing-policiesSKILL.md

≈1.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Managing policies

Result: a policy set that grants the intended access and nothing more, tested from a non-root credential, with denials explained by policy evaluations.

Reference

  • resources: policy command records and update field names.
  • activities: policy evaluations and consensus votes.

Rules

  • Write policies against tag ids and secret static properties. Name a user or resource id only where the reference says it is unavoidable.
  • A DENY overrides every ALLOW. Never delete a containment DENY to make an activity succeed.
  • Consensus must contain a clause the submitter satisfies, or the activity is denied at submission instead of waiting for approval.
  • Test from the constrained credential. Root success proves nothing about agent access.
  • Keep expressions exactly as written; only the ${UPPER_SNAKE} id variables interpolate.

Instructions

Inputs: the root profile (admin), AGENT_TAG and the other tag ids from bootstrapping-organization, and the approval cell. Read policy-language.md for grammar and policy-patterns.md for the policy set.

  1. State the change. Before any mutation, write down effect, condition, consensus, and which users the consensus selects. If the request is "make this denied activity work", read the denial first (step 5) and return the smallest change that fits the requested access.

  2. Create a policy. Root. Flags for one policy:

    <!-- example: policies.create -->
    tk --profile admin --message-format json policy create --name agents-export-unilateral --effect allow \
      --consensus "approvers.any(user, user.tags.contains('${AGENT_TAG}'))" \
      --condition "activity.type == 'ACTIVITY_TYPE_EXPORT_SECRETS' && secret.static_properties['consensus'] == 'unilateral'" \
      --notes "allow-always: agents read unilateral secrets alone"

    Save data.activity.result.createPolicyResult.policyId. For several policies at once, policy create-batch --input-file ./policies.json takes {"policies":[...]} with policyName, effect, condition, consensus, notes.

  3. Confirm what was stored.

    <!-- example: policies.get -->
    tk --profile admin --message-format json policy get --id POLICY_ID
    tk --profile admin --message-format json policy list

    data.policy.condition and data.policy.consensus must equal the expressions from step 1 character for character.

  4. Test from the constrained credential. Run the intended allowed operation and one operation that must be denied as the tagged user. The allowed one returns status: "completed" or, for allow-once, pending; the denied one fails with unauthorized and HTTP 403.

  5. Explain a denial or a pending vote.

    <!-- example: policies.evaluations -->
    tk --profile admin --message-format json policy evaluations --activity-id ACTIVITY_ID

    data.policyEvaluations[] carries one entry per vote with policyEvaluations[].policyId and outcome. A DENY outcome names the policy to read; no ALLOW outcome means no policy matched. A 403 with no activity id means the request was refused before an activity existed; compare the submitter's tags against the consensus clauses.

  6. Update or delete. Root. Updates use policyId with the policy-prefixed field names:

    <!-- example: policies.update -->
    tk --profile admin --message-format json policy update --input-json '{"policyId":"POLICY_ID","policyNotes":"revised"}'
    tk --profile admin --message-format json policy delete --id POLICY_ID

    Re-run step 3 after an update. Deleting an ALLOW removes access immediately; deleting a DENY may widen access, so re-run step 4.

  7. Hand off. Report each policy id with its name, effect, condition, and consensus, and the allowed and denied operations that were tested. Stop.

Verified by

Examples Test
policies.create, policies.get, policies.evaluations, policies.update policies::managing_policies_crud_and_evaluations
policies.evaluations policies::quorum_approval_completes_and_rejection_fails_a_consensus_activity

Troubleshooting

  • policy create fails with usage_error: --name needs --effect and at least one of --condition or --consensus.
  • policy update fails with invalid_input naming an unsupported field: updates use policyEffect, policyCondition, policyConsensus, and policyNotes, not the create names.
  • The constrained user gets unauthorized on an operation the ALLOW covers: check activity.type spelling against the table in policy-language.md, and check that the user actually carries the tag with tk --profile admin --message-format json user get --id USER_ID.
  • The activity is pending when it should complete: the consensus names a second party. That is allow-once behavior; approve it, or change the consensus if unilateral was intended.
  • The activity is denied when it should be pending: no consensus clause is satisfiable by the submitter. Add the submitter's tag clause.
  • A root user approves and everything passes: the root quorum bypassed the policies. Repeat the test with a non-root approver.

Related Skills

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 6fd5c16. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated last month

README badge

README badge for tkhq/tk/skills