Register and share your invite link to earn from video plays and referrals.

Search results for MODUFY
MODUFY community
One keyword maps to one global community path.
Create community
People
Not Found
Tweets including MODUFY
# Useful but Little-Known Features of Claude Agent SDK 🌍 Let AI modify your files with confidence -- you can always roll back. File checkpointing automatically tracks changes made by Write/Edit/NotebookEdit and lets you rewind to any point in time. 📌 Title: File Checkpointing and Rollback 🔗 URL: 🧩 Overview File checkpointing tracks file modifications during agent sessions. When you set enable_file_checkpointing=True, the SDK creates backups before any Write, Edit, or NotebookEdit tool modifies a file. Each UserMessage's UUID serves as a checkpoint, and you can call rewind_files() with that UUID to restore files to that point. Created files get deleted, and modified files are restored to their original content. 🛠 How to Use ```python import asyncio from claude_agent_sdk import ( ClaudeSDKClient, ClaudeAgentOptions, UserMessage, ResultMessage, ) async def main(): # Step 1: Enable checkpointing options = ClaudeAgentOptions( enable_file_checkpointing=True, permission_mode="acceptEdits", extra_args={"replay-user-messages": None}, # Required for UUIDs ) checkpoint_id = None session_id = None async with ClaudeSDKClient(options) as client: await client.query("Refactor the authentication module") # Step 2: Capture checkpoint UUID from UserMessage async for message in client.receive_response(): if isinstance(message, UserMessage) and message.uuid and not checkpoint_id: checkpoint_id = message.uuid if isinstance(message, ResultMessage) and not session_id: session_id = message.session_id # Step 3: Resume session and rollback if checkpoint_id and session_id: async with ClaudeSDKClient( ClaudeAgentOptions( enable_file_checkpointing=True, resume=session_id ) ) as client: await client.query("") # Empty prompt to open connection async for message in client.receive_response(): await client.rewind_files(checkpoint_id) break print(f"Rewound to checkpoint: {checkpoint_id}") ``` 🏗 Integration into Production Systems - extra_args={"replay-user-messages": None} is required; without it, UUIDs won't appear in the stream - To rollback, resume the session, send an empty prompt, then call rewind_files() - Persist checkpoint UUIDs and session IDs to enable rollback after process restarts - Combine with permission_mode="acceptEdits" to auto-approve file changes while maintaining rollback safety 💡 Use Cases 🔧 Safe refactoring: try changes and instantly rollback if issues arise 🧪 Experimental code generation: validate AI output and revert if quality is low 📝 Auto-generated documentation: review results and undo unwanted changes ⚠️ Caveats - Changes via Bash commands (echo > file.txt, sed -i, etc.) are NOT tracked - Only file content is tracked; directory creation/move/deletion is not undone - Conversation history is not rolled back -- only files are restored - Checkpoints are tied to the session that created them ✨ Develop fearlessly with "undo-able" AI -- let the agent code with confidence! #ClaudeAgentSDK# #AIAgent#
Show more
Jobs are bundles of tasks. AI and other technologies may eliminate or modify some of many of these tasks, but rarely all of them. Very interesting reporting from the @FT about how AI is changing rather than eliminating entry-level jobs.
Show more
Former first-round pick Joe Tryon-Shoyinka abruptly retires from NFL at 27
With the Autodesk Fusion connector, designers and engineers can create and modify 3D models through conversation.
0
433
21.6K
2K
Forward to community
I'm just here to say fuck AI 🙂👍 The day you see me use AI to modify anything, then I've gone insane.
NEWS: Grok Build's entire agent harness is fully open source. Unlike platforms that only open-source parts of their stack, Grok Build gives developers access to the actual agent harness. • Inspect the source code. • Modify it to fit your needs. • Compile it yourself. • Run it with your own inference models. A fully open foundation for developers who want complete control over their AI workflows.
Show more
# Useful but Little-Known Features of Claude Agent SDK 🌍 Watch, block, or modify agent behavior -- all through hooks. Rich hook events let you intercept everything from tool calls to subagent completion at any point. 📌 Title: Rich Hook Events 🔗 URL: 🧩 Overview The Claude Agent SDK hook system lets you register callback functions at key points in agent execution. Events available in both Python and TypeScript include: PreToolUse (before tool call), PostToolUse (after tool execution), PostToolUseFailure (on tool failure), UserPromptSubmit (prompt submission), Stop (execution stop), SubagentStart/Stop (subagent lifecycle), PreCompact (before conversation compaction), PermissionRequest (permission dialog), and Notification (status messages). Callbacks run in the app process, not in the context window. 🛠 How to Use ```python import asyncio from claude_agent_sdk import ( ClaudeSDKClient, ClaudeAgentOptions, HookMatcher, AssistantMessage, ResultMessage, ) # Hook to block writes to .env files async def protect_env_files(input_data, tool_use_id, context): file_path = input_data["tool_input"].get("file_path", "") file_name = file_path.split("/")[-1] if file_name == ".env": return { "hookSpecificOutput": { "hookEventName": input_data["hook_event_name"], "permissionDecision": "deny", "permissionDecisionReason": "Cannot modify .env files", } } return {} # Hook to log all tool calls async def audit_logger(input_data, tool_use_id, context): print(f"[AUDIT] Tool: {input_data['tool_name']}, ID: {tool_use_id}") return {} async def main(): options = ClaudeAgentOptions( hooks={ "PreToolUse": [ HookMatcher(matcher="Write|Edit", hooks=[protect_env_files]), HookMatcher(hooks=[audit_logger]), ], } ) async with ClaudeSDKClient(options=options) as client: await client.query("Update the configuration files") async for message in client.receive_response(): if isinstance(message, (AssistantMessage, ResultMessage)): print(message) ``` 🏗 Integration into Production Systems - Return permissionDecision in hookSpecificOutput to allow/deny/ask/defer tool calls - Multiple hooks on the same event run in parallel; the most restrictive decision wins (deny > defer > ask > allow) - Use additionalContext in PostToolUse hooks to append info to tool results - Return async_=True for fire-and-forget side effects (logging, metrics) without blocking the agent 💡 Use Cases 🛡 Security: block access to sensitive files/directories with PreToolUse 📊 Audit logging: record every tool call with PostToolUse 🔔 Notification integration: forward status updates to external services (Slack, etc.) via Notification hooks 🔄 Input transformation: redirect file paths to sandbox using updatedInput in PreToolUse ⚠️ Caveats - Hooks run in the app process; implement error handling to prevent unhandled exceptions from interrupting the agent - Returning "allow" from a PreToolUse hook does NOT skip subsequent deny rules or permission mode evaluation - Matchers only match tool names, not file paths. Check tool_input inside the callback for path filtering - Default hook timeout is 60 seconds ✨ Hold the reins of your agent for safe and transparent automation! #ClaudeAgentSDK# #AIAgent#
Show more