Agentic Workflow Automation: Leveraging Claude Code, ClickUp Integration, and Persistent Local Context for Autonomous Document Retrieval
In the landscape of modern productivity, the bottleneck is rarely a lack of access to information; rather, it is the cognitive load associated with the retrieval, verification, and movement of unstructured data across disparate SaaS ecosystems. Traditional automation—built on rigid, rule-based logic (e.g., Zapier or Make)—often fails when faced with the high entropy of real-world workflows, such as retrieving invoices where email subject lines vary, portal UIs change, or authentication states fluctuate.
This post explores a paradigm shift from brittle automation to Agentic Workflows. Using Claude Code and an orchestrated agent architecture, we demonstrate how to automate complex, multi-step document retrieval tasks that involve interacting with project management tools (ClickUp), cloud storage (Dropbox), email clients (Gmail/Outlook), and web browsers (Chrome) through a unified, context-aware local environment.
The Architecture: Persistent Local Context vs. Ephemeral Chat History
A common failure point in LLM implementation is the reliance on "chat memory," which is inherently ephemeral and limited by context window constraints. To build a scalable system, we implement a Local Folder-as-Memory architecture.
In this setup, an AI agent (referred to here as "Larry," the Orchestrator) operates within a dedicated local directory. This directory serves as the single source of truth, containing:
- Team Knowledge: Plain text files defining the roles and capabilities of various agents.
- Work Streams (SOPs): Standard Operating Procedures stored as Markdown or text files that define recurring workflows.
- Guidelines: Global business logic and constraints that govern agent behavior.
- Decision Logs: A structured record of human-in-the-loop interventions, allowing the agent to learn from past resolutions.
By using a local folder, we decouple the intelligence (the LLM) from the state (the files). This allows any model—be it Claude, Gemini, or GPT-4—to be pointed at the same directory and immediately inherit the entire business context without manual prompting.
The Workflow: From ClickUp Subtasks to Dropbox Assets
The specific use case involves processing a backlog of missing invoices identified in ClickUp. The workflow follows an agentic loop initiated by a single high-level goal via the /goal command in Claude Code.
1. Task Parsing and Context Injection
The process begins with the agent accessing ClickUp via established connections (utilizing IPI-style integrations). The agent parses specific subtasks within a project list, extracting critical metadata: invoice date, vendor name, and transaction amount. This structured data serves as the search parameters for the subsequent retrieval phases.
effectively executing the Retrieval Loop
The agent executes a multi-modal retrieval strategy across three primary vectors:
Vector A: Email Scraping (Gmail/Outlook)
Using authenticated access to mail servers, the agent performs targeted searches based on the extracted metadata. It identifies threads containing PDF attachments and extracts them directly from the MIME structure of the email.
Vector B: Browser Automation (Chrome via Claude Desktop/VS Code)
When an invoice is not present in email archives—common with subscription-based SaaS models—the agent transitions to web automation. Utilizing Chrome, the agent navigates to specific vendor portals (e.g., OpenAI, Perplexity, Todoist, Bitly, Heptabase).
The technical sophistication here lies in the agent's ability to handle unstructured UI elements. Unlike a Selenium script that might break if a CSS selector changes, an LLM-driven agent uses visual and DOM analysis to identify "Download Invoice" buttons or navigate through complex billing dashboards. If the agent encounters a login wall (e.g., Zapier), it triggers a Decision/Warning System, pausing execution to request human intervention via a specific decision code (e.g., Q3A).
Vector C: File System Management
Once retrieved, the agent handles the normalization of filenames—ensuring they follow a standardized convention (e.g., YYYY-MM-DD_Vendor_Amount.pdf)—and uploads them to a structured hierarchy within Dropbox. This ensures that downstream stakeholders, such as accountants, have immediate access to organized, audit-ready documentation.
The "Work Stream" Evolution: Automating the Automation
The most critical step in this architecture is not just performing the task, but the autonomous creation of a Work Stream. Upon successful completion of a manual or semi-automated run, the agent is instructed to document its own procedure.
By writing a new Work Stream file into the local directory, the agent effectively "codifies" its success. This transforms a one-off prompt into a permanent, repeatable asset. The next time an invoice retrieval task is initiated, the agent does not need to be re-taught; it simply reads the newly created SOP and executes with higher precision.
Conclusion: Moving Beyond Brittle Automations
The transition from "Automation" to "Agentic Orchestration" represents a fundamental shift in how we approach digital labor. While traditional automation requires an engineer to map every possible edge case, Agentic Workflows leverage the LLM's ability to reason through ambiguity and handle unexpected state changes (like a changed email subject or a new portal layout).
By investing in a local-first, file-based knowledge architecture, businesses can build a persistent, growing intelligence that scales with their complexity, rather than breaking under it.