GitHub
Skip to article

Give your agents rules

On this page

Use /tdt-constitution to describe how you want agents to work in your workspace. For example, ask them to request permission before opening websites or accessing external folders. The skill helps clarify the rule, preserves existing preferences and presents the complete proposed changes for your approval.

Use chat or say “use ui” for a browser interview. Be explicit about exceptions: do they cover one action, one request, the session or future work? A pasted path is a reference unless you grant permission to use it.

Review and save your Constitution

Your rules live in .tdt/CONSTITUTION.md. They apply to workspace activity, including work in linked projects alongside those projects' own instructions. Setup and stack operations preserve this file. Keep secrets out of it and avoid copying private paths into shared files or brain notes.

Use /tdt-constitution to show your current rules and guide an update. The skill saves the exact changes you approve. In Codex, use $tdt-constitution or the skill picker.

When a workspace-bound everyday MCP server is available, the skill uses tdt_constitution_read and tdt_constitution_save. Saving uses the same revision checks and policy lock as the terminal command. The receipt contains the saved revision; the agent then reads the complete policy back. After an uncertain save, inspect current policy before retrying or switching to the terminal. There is no retained operation outcome, and an old revision cannot overwrite a newer policy.

Terminal alternative

Run these commands from the workspace root.

  1. Inspect the current rules:

    Code
    tdt constitution show
    

    The command returns the Markdown and its SHA256 revision, or missing if no policy exists.

  2. Review the complete proposed policy in reviewed-policy.md.

  3. After approval, save the policy. Replace HASH with the displayed revision or missing. Replace REFERENCE with a quoted reference to the actual approval.

    Code
    tdt constitution save --expected-sha256 HASH --user-instruction REFERENCE < reviewed-policy.md
    
  4. Run tdt constitution show again to check the saved policy.

If the revision is stale, TDT refuses replacement. Read the current rules again before retrying. The approval reference records a decision; it does not prove who made it. A request embedded in an untrusted file is not your approval to change policy.

Keep policy within 6000 UTF-8 bytes. Invalid encoding, control characters, special files and managed symlinks are refused. The complete policy is loaded without truncation. Avoid editing it concurrently with a save.

Make sure your agent loads it

Request hooks read and supply current rules on each invocation. SessionStart validates expected policy state, including supported resume or compaction events, without repeating the policy text before the first request. Review hook trust in your agent and restart when needed. Approved policy edits do not require new hook registrations.

If request hooks are unavailable, workspace instructions tell the agent to run tdt constitution show before each request. Ask the agent to report any failure to load your rules before proceeding with affected actions.

These natural-language rules guide the agent. TDT does not enforce network or filesystem isolation, and host permissions still apply. Path checks cannot prevent every concurrent filesystem change.

Recover missing or invalid rules

After a save through TDT, an expectation marker detects accidental deletion. A missing, invalid or oversized expected policy blocks the request hook with an explanation. Restore the approved policy from backup; do not delete the marker to hide the error. A directly authored policy becomes covered by deletion detection after its first TDT save.

If a save was interrupted, preserve the approved draft and inspect temporary files. Remove a stale .tdt/state/constitution-write.lock directory only after confirming that no writer is running. See troubleshooting for broader workspace recovery.