<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ramkumar C on Medium]]></title>
        <description><![CDATA[Stories by Ramkumar C on Medium]]></description>
        <link>https://medium.com/@ramkumar.c233?source=rss-d665a73113b6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*G68Yt0bJ8ZbKcW6V</url>
            <title>Stories by Ramkumar C on Medium</title>
            <link>https://medium.com/@ramkumar.c233?source=rss-d665a73113b6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:53:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramkumar.c233/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CoCo Control Hub: A Self-Service Cortex Code Spend Governance App Built on SiS]]></title>
            <link>https://medium.com/@ramkumar.c233/coco-control-hub-a-self-service-cortex-code-spend-governance-app-built-on-sis-f411dfe59ee9?source=rss-d665a73113b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f411dfe59ee9</guid>
            <category><![CDATA[ai-spend]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[cortex-code]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Ramkumar C]]></dc:creator>
            <pubDate>Fri, 29 May 2026 03:03:36 GMT</pubDate>
            <atom:updated>2026-08-11T19:07:10.163Z</atom:updated>
            <content:encoded><![CDATA[<p>───────────────────────────────────────────────</p><p><em>Stop managing AI credits with ALTER USER. Start governing them intelligently — cohort budgets, model tiers, and auto-rebalancing, all inside Snowflake.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCsM5PauqxfPXLA8erR70w.png" /></figure><p>Day 3:</p><p>Your company just rolled out <strong>Snowflake Cortex Code </strong>to 3,000 engineers across ten clinical and operational domains. Clinical Data Science. Research and Genomics. Care Management. Health Informatics. Platform Engineering.</p><p>By Thursday morning, the Chief Data Officer sends a message: <em>40% of the monthly AI budget is gone. It is 10 AM.</em></p><p>You pull the usage data. Clinical Data Science has 300 engineers. Two of them — a pair of researchers running genomic analysis pipelines with Opus — consumed what was meant to last the entire team through the month. The other 298 engineers are now effectively locked out for the next three weeks.</p><p>The platform admin gets 47 Slack messages by noon. Each one is a developer or analyst asking for more credits. The admin has no tooling to handle this at scale. Every request is manual. Every one requires an ALTER USER statement.</p><p>This is the problem <strong>CoCo Control Hub </strong>was built to solve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHd0jZ7txPFwLuCxBE4MzA.png" /></figure><p><strong>What Snowflake Gives You</strong></p><p>Snowflake’s Cortex Code provides exactly the right primitive — a per-user daily credit limit:</p><pre>ALTER ACCOUNT SET CORTEX_CODE_CLI_DAILY_EST_CREDIT_LIMIT_PER_USER = 20;<br>ALTER USER john SET CORTEX_CODE_CLI_DAILY_EST_CREDIT_LIMIT_PER_USER = 30;</pre><p>This works perfectly for small teams. It is the right building block. The challenge is that enterprise deployments — especially in regulated industries like healthcare where AI governance is not optional — need patterns layered on top.</p><p>Team-level budgets. Self-service workflows. Immutable audit trails. Intelligent redistribution across thousands of users.</p><p>That is what this app builds.</p><p><strong>The Architecture: Owner-Rights Execution</strong></p><p>The most important architectural decision — and the one that makes everything else work — is Snowflake’s owner-rights model for Streamlit apps.</p><p>When a Streamlit app is owned by a role with elevated privileges, every SQL statement executes as that owner role, not as the end user viewing the app. A clinical analyst with no Snowflake admin access can trigger an ALTER USER through the app — and the stored procedure validates, executes, and logs it.</p><pre>    Streamlit (owned by ACCOUNTADMIN)<br>        │<br>        ├── Read queries ──► CC_* tables (direct)<br>        └── Elevated actions ─► CALL SP (owner-rights)<br>                                    │<br>                                    ├── ALTER USER SET credit limit<br>                                    └── GRANT DATABASE ROLE to user</pre><p>The Python code never touches ALTER USER directly. Every privileged action goes through a stored procedure that validates the input, executes the change, and writes to the audit log. If someone finds a bug in the Python layer, they cannot directly modify account settings — they can only call the SP, which runs its own validation independently.</p><p>This pattern is underused in the Snowflake ecosystem. It is the right answer for any governance app that needs to take elevated actions on behalf of unprivileged users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*E04Q3Zj7Xarvl3zNMc3MDw.png" /></figure><p><em>Access Management — grant CORTEX_USER and COPILOT_USER to users, roles, or user tag groups at enterprise scale.</em></p><p><strong>Cohort Budgets: The First Layer</strong></p><p>Back to those 300 researchers in Clinical Data Science. The correct answer to the Day 3 problem is not setting a higher limit for each individual. It is setting a team budget.</p><p>The app lets an admin select “Clinical Data Science” as a Snowflake role or user tag, set daily limits across all three Cortex Code surfaces — CLI, Snowsight, and Desktop — and apply to all 300 members in a single operation. One stored procedure call. No Python loop. No 300 individual ALTER USER statements timing out in the browser.</p><p>Every new researcher who joins the role inherits the limit automatically. Every clinical domain has its own budget. The Chief Data Officer can track AI spend by team, not just by individual researcher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*iSepiSs2ojGACHnRJHEz_w.png" /></figure><p><em>Cohort Configuration — set daily limits across CLI, Snowsight, and Desktop surfaces for an entire team in one operation.</em></p><p><strong>Self-Service: Solving the 47 Slack Messages</strong></p><p>The 47 messages are the real problem. Each one is an analyst or researcher blocked from their work. The admin answering them is pulled away from platform work. And most of those researchers’ teammates have unused credits sitting idle.</p><p>When a user hits their limit, they open the app and submit a request. The system does not just queue a ticket. It runs a full analysis of their cohort.</p><p>For each teammate, it asks: how much of their daily limit will they actually use today? This is where simple averages fail. If a genomics researcher uses 8 credits on Mondays running pipeline jobs but only 2 on Fridays doing documentation, averaging those to 5 misrepresents both days. The engine uses EWMA — exponentially weighted moving averages — to weight recent observations more heavily.</p><pre>    def _ewma(values, alpha=0.3):<br>        result = values[0]<br>        for v in values[1:]:<br>            result = alpha * v + (1 - alpha) * result<br>        return result</pre><p>With alpha=0.3, the most recent observation contributes 30% of the prediction, the one before it contributes 21%, the one before that 14.7%, and so on. A researcher who started running heavy analysis jobs this week will show up as a higher-usage predictor than their historical average would suggest. One who is wrapping up a project and using less will show a lower prediction.</p><p>The engine also adds a day-of-week adjustment and a 20% safety buffer on top. The result is a surplus estimate that is conservative by design.</p><p>That surplus is then offered to the requester. In AUTO mode, the ALTER USER statements execute immediately. In ADMIN mode, the request queues for a domain lead with the recommendation already shown. Either way, the admin is out of the critical path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*ZIWKncTd5DbOubtAcW3Dxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*NYmIQubEKMy9HnPY1WgA1Q.png" /></figure><p><em>User Distribution scatter plot. Instantly surfaces power users, outliers, and teams consuming disproportionately.</em></p><p><strong>Model Tiers: Who Gets Opus?</strong></p><p>The Day 3 problem has a second dimension: model access. Those two researchers ran everything on Opus. Sonnet would have handled 80% of their work at a fraction of the credit cost.</p><p>Snowflake’s CORTEX_MODELS_ALLOWLIST parameter gives admins precise per-user model control. The app layers a tier system on top. TIER_1 for Opus — complex genomic analysis, multi-step reasoning, large document synthesis. TIER_2 for Sonnet — daily development, pipeline debugging, report generation. TIER_3 for fast completions and formatting.</p><p>Each model card in the tier manager shows its capabilities, the clinical and technical personas it is designed for, and 30-day credit consumption across all users. Admins assign models to tiers, map tiers to roles, and the app propagates the changes. What used to require scripting is now a guided interface with full usage context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*I1gAYnDK1IYH-asZj3cRiw.png" /></figure><p><em>Interactive Tier Management — create tiers, review each model’s capabilities and 30-day usage, assign or remove with one click.</em></p><p><strong>The Concurrency Problem (The Interesting Part)</strong></p><p>Here is where it gets genuinely tricky.</p><p>At scale, two researchers in the same clinical team hit their limit at the same moment. Both requests run the surplus analysis. Both identify the same teammate as a donor. Both reduce that donor’s limit by 5. The donor loses 10 credits instead of 5.</p><p>The naive fix — check the donor’s current limit before deducting — does not work. Between the read and the write, another request can slip through.</p><p>The real fix is a TTL-based cohort lock:</p><pre>    CREATE TABLE CC_COHORT_REBALANCE_LOCK (<br>        COHORT_ROLE   VARCHAR PRIMARY KEY,<br>        LOCKED_BY     VARCHAR NOT NULL,<br>        LOCKED_AT     TIMESTAMP_LTZ,<br>        EXPIRES_AT    TIMESTAMP_LTZ   -- 120-second TTL<br>    );</pre><p>Before the surplus analysis begins, the stored procedure executes a MERGE:</p><pre>    MERGE INTO CC_COHORT_REBALANCE_LOCK t<br>    USING (SELECT &#39;CC_CLINICAL_DS&#39; AS C) s ON t.COHORT_ROLE = s.C<br>    WHEN NOT MATCHED THEN INSERT (COHORT_ROLE, LOCKED_BY, EXPIRES_AT)<br>        VALUES (&#39;CC_CLINICAL_DS&#39;, &#39;requester&#39;, DATEADD(&#39;second&#39;, 120, CURRENT_TIMESTAMP()))</pre><p>If the MERGE inserts 0 rows, the cohort is already locked. Return a message. Try again in a moment. If it inserts 1 row, you hold the lock — analysis proceeds, ALTER USER statements execute, lock released.</p><p>Snowflake’s MVCC model does not guarantee perfect serialization for true simultaneous requests. But combined with the 20% safety buffer and the 50% maximum transfer cap — donors can never lose more than half their daily limit in a single rebalance — the system is conservative enough that edge cases cause modest over-transfer, not negative limits.</p><p>The entire pipeline — lock, analysis, execution, release — runs in one stored procedure call. One round-trip from Python. The Streamlit session can disconnect after the call is made and the SP completes on Snowflake’s servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*4NyCmQ7HRy3fbQ--4qsckQ.png" /></figure><p><em>Self-service credit requests — usage progress bars per surface, EWMA surplus analysis runs server-side, auto-approves or queues with donor recommendation already identified.</em></p><p><strong>What This Pattern Teaches</strong></p><p>The Day 3 problem is not unique to Cortex Code or to healthcare. It is the standard enterprise AI adoption arc: broad rollout, uneven consumption, budget concern, platform team bottleneck.</p><p>The pattern that solves it is governance-as-code — treating AI credit management the same way mature engineering teams treat infrastructure: automated, auditable, self-service where safe, human-reviewed where not.</p><p>Snowflake’s owner-rights model, stored procedures, and Streamlit-in-Snowflake together provide exactly the right primitives. You do not need external orchestration, a separate database, or a custom API layer. The governance logic can live entirely inside Snowflake, run with the right privileges through a well-designed SP layer, and be accessed through a Streamlit interface that enforces policy automatically.</p><p>Every enterprise deploying Cortex Code at scale will need some version of this. The architecture is reusable. The patterns transfer across industries. The Day 3 problem has the same shape whether the domain is healthcare, financial services, or manufacturing. The 47 Slack messages become two, handled through the self-service flow. The CDO gets a weekly team-level spend report instead of a Thursday morning alert.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*Tx6eqeSs1dDY0dqU7ffdMQ.png" /></figure><p><em>Setup verification — green and red chip grid confirms every table, SP, task, and role was created correctly.</em></p><p>Full source, documented, and deployable in under 30 minutes. Clone it, configure four lines in config.yaml, and you have a running governance layer.</p><p><a href="https://www.snowflake.com/en/developers/guides/cortex-code-control-hub/">https://www.snowflake.com/en/developers/guides/enterprise-cortex-code-governance/</a>───────────────────────────────────────────────</p><p><strong>Disclaimer:</strong> The opinions and views expressed in this article are of our own and do not necessarily reflect those of my employer.</p><p><strong><em>Built with CoCo. Ramkumar Chandrasekaran, Snowflake.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f411dfe59ee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Snowflake Cortex Code CLI with Custom Hooks]]></title>
            <link>https://medium.com/@ramkumar.c233/supercharge-your-snowflake-cortex-code-cli-with-custom-hooks-58a53a4017cd?source=rss-d665a73113b6------2</link>
            <guid isPermaLink="false">https://medium.com/p/58a53a4017cd</guid>
            <category><![CDATA[snowflake-cortex-ai]]></category>
            <category><![CDATA[claude-code-hooks]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[snowflake-cortex]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Ramkumar C]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 04:12:58 GMT</pubDate>
            <atom:updated>2026-02-10T04:12:58.888Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Snowflake Cortex Code CLI </strong>is an AI-powered development assistant that helps you write, debug, and navigate code directly from your terminal. It reads files, executes commands, generates code, and understands complex codebases — all through natural conversation.</p><p>But what makes Cortex Code truly powerful isn’t just what it can do out of the box. It’s how you can customize it to fit your workflow.</p><p><strong>Hooks</strong> are the answer. They allow you to execute custom shell commands automatically when specific events occur during your Cortex Code CLI session — whether that’s before a tool runs, after a file is modified, or when you submit a prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*C6kZo0M1yrOATd4T8A-EaA.png" /></figure><p>With hooks, you can:</p><blockquote><strong>Add security guardrails</strong> — Block dangerous operations like rm -rf or DROP TABLE before they execute</blockquote><blockquote><strong>Build AI analytics</strong> — Auto-push every conversation to Snowflake and analyze productivity with Cortex AI</blockquote><blockquote><strong>Enforce team standards</strong> — Automatically inject coding guidelines and project context into every session</blockquote><blockquote><strong>Audit everything</strong> — Track every tool call, permission request, and AI interaction for compliance</blockquote><blockquote><strong>Transform prompts</strong> — Enrich user inputs with relevant context before they reach the AI</blockquote><blockquote>And much more…</blockquote><p><strong>Quick Setup:</strong></p><p><strong>Configuration : </strong>Hooks are defined in a single JSON file:</p><pre>~/.snowflake/cortex/hooks.json</pre><p>If the file doesn’t exist, create it manually. Cortex Code will automatically load your hooks on startup.</p><p><strong>Basic Structure:</strong></p><pre>{<br>&quot;hooks&quot;: {<br>&quot;EventName&quot;: [<br>{ &quot;hooks&quot;: [{ &quot;type&quot;: &quot;command&quot;, &quot;command&quot;: &quot;/path/to/script.sh&quot;, &quot;timeout&quot;: 30 }] }<br>]<br>}<br>}</pre><p><strong>Script Requirements:</strong></p><ol><li>Make executable: chmod +x script.sh</li></ol><pre>chmod +x /path/to/your/script.sh</pre><p>2. Read stdin: INPUT=$(cat)</p><p>Cortex Code passes event data as JSON to your script via stdin:</p><pre>#!/bin/bash<br>INPUT=$(cat)</pre><p>3. Output JSON: echo ‘{“continue”: true}’ or {“continue”: false} to block</p><p>Your script must output one of these responses:</p><pre># Allow the operation to proceed<br>echo &#39;{&quot;continue&quot;: true}&#39;<br><br># Block the operation with a message<br>echo &#39;{&quot;continue&quot;: false, &quot;message&quot;: &quot;Operation blocked: reason here&quot;}&#39;</pre><p><strong>10 Hook Events with Simple Examples:</strong></p><ol><li><strong>SessionStart</strong></li></ol><p><strong>When: </strong>Cortex Code launches | <strong>Use for: </strong>Welcome messages, environment setup</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>echo &quot;Welcome to Cortex Code!&quot;<br>echo &quot;Config: file://$HOME/.snowflake/cortex/hooks.json&quot;<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>2. <strong>SessionEnd</strong></p><p><strong>When: </strong>Session ends normally | <strong>Use for: </strong>Upload conversations to Snowflake, cleanup</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>SESSION_ID=$(echo &quot;$INPUT&quot; | jq -r &#39;.session_id&#39;)<br>snow sql -c myconn -q &quot;PUT &#39;file://~/.snowflake/cortex/conversations/${SESSION_ID}.json&#39; @MY_STAGE&quot;<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>3. <strong>PreToolUse</strong></p><p><strong>When: </strong>Before any tool executes | <strong>Use for: </strong>Security guardrails, block dangerous operations</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>TOOL_INPUT=$(echo &quot;$INPUT&quot; | jq -r &#39;.tool_input&#39;)<br><br>if echo &quot;$TOOL_INPUT&quot; | grep -qi &quot;DROP TABLE&quot;; then<br>  echo &#39;{&quot;continue&quot;: false, &quot;message&quot;: &quot;DROP TABLE blocked!&quot;}&#39;<br>  exit 0<br>fi<br><br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>4. <strong>PostToolUse</strong></p><p><strong>When: </strong>After a tool completes | <strong>Use for: </strong>Track metrics, capture outputs</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>TOOL_NAME=$(echo &quot;$INPUT&quot; | jq -r &#39;.tool_name&#39;)<br>echo &quot;$(date): $TOOL_NAME&quot; &gt;&gt; /tmp/cortex_tool_audit.log<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>5. <strong>UserPromptSubmit</strong></p><p><strong>When: </strong>User submits a prompt | <strong>Use for: </strong>Filter sensitive info, validate input</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>PROMPT=$(echo &quot;$INPUT&quot; | jq -r &#39;.prompt&#39;)<br><br>if echo &quot;$PROMPT&quot; | grep -qi &quot;password&quot;; then<br>  echo &#39;{&quot;continue&quot;: true, &quot;message&quot;: &quot;Warning: Sensitive info detected!&quot;}&#39;<br>  exit 0<br>fi<br>echo &#39;{&quot;continue&quot;: true}&#39; </pre><p>6. <strong>PermissionRequest</strong></p><p><strong>When: </strong>AI requests elevated permissions | <strong>Use for: </strong>Audit access, block sensitive directories</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>RESOURCE=$(echo &quot;$INPUT&quot; | jq -r &#39;.resource&#39;)<br><br>if echo &quot;$RESOURCE&quot; | grep -q &quot;/.ssh&quot;; then<br>  echo &#39;{&quot;continue&quot;: false, &quot;message&quot;: &quot;SSH directory access blocked!&quot;}&#39;<br>  exit 0<br>fi<br><br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>7. <strong>Stop</strong></p><p><strong>When: </strong>Session forcefully stopped (Ctrl+C) | <strong>Use for: </strong>Graceful shutdown, cleanup</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>REASON=$(echo &quot;$INPUT&quot; | jq -r &#39;.reason&#39;)<br>echo &quot;$(date): Stopped - $REASON&quot; &gt;&gt; /tmp/cortex_stops.log<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>8. <strong>Notification</strong></p><p><strong>When: </strong>Cortex generates a notification | <strong>Use for: </strong>Send to Slack, email alerts</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>MESSAGE=$(echo &quot;$INPUT&quot; | jq -r &#39;.message&#39;)<br>curl -X POST &quot;$SLACK_WEBHOOK&quot; -d &quot;{\&quot;text\&quot;: \&quot;$MESSAGE\&quot;}&quot;<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>9. <strong>PreCompact</strong></p><p><strong>When: </strong>Before context summarization | <strong>Use for: </strong>Archive full context</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>CONTEXT_SIZE=$(echo &quot;$INPUT&quot; | jq -r &#39;.context_size&#39;)<br>echo &quot;$(date): Compacting $CONTEXT_SIZE tokens&quot; &gt;&gt; /tmp/cortex_compactions.log<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p>10. <strong>SubagentStop</strong></p><p><strong>When: </strong>A parallel AI task completes | <strong>Use for: </strong>Track subagent performance</p><pre>#!/bin/bash<br>INPUT=$(cat)<br>STATUS=$(echo &quot;$INPUT&quot; | jq -r &#39;.status&#39;)<br>echo &quot;$(date): Subagent $STATUS&quot; &gt;&gt; /tmp/cortex_subagents.log<br>echo &#39;{&quot;continue&quot;: true}&#39;</pre><p><strong>A complete example:</strong></p><pre>{<br>  &quot;hooks&quot;: {<br>    &quot;SessionStart&quot;: [<br>      {<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;~/.snowflake/cortex/hooks/welcome.sh&quot;<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;SessionEnd&quot;: [<br>      {<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;~/.snowflake/cortex/hooks/upload.sh&quot;,<br>            &quot;timeout&quot;: 30<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;PreToolUse&quot;: [<br>      {<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;~/.snowflake/cortex/hooks/safety.sh&quot;<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;PostToolUse&quot;: [<br>      {<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;~/.snowflake/cortex/hooks/audit.sh&quot;<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;Notification&quot;: [<br>      {<br>        &quot;hooks&quot;: [<br>          {<br>            &quot;type&quot;: &quot;command&quot;,<br>            &quot;command&quot;: &quot;~/.snowflake/cortex/hooks/slack.sh&quot;<br>          }<br>        ]<br>      }<br>    ]<br>  }<br>}</pre><p>You can even push conversations to Snowflake after every session and analyze with Cortex AI:</p><pre>SELECT SNOWFLAKE.CORTEX.COMPLETE(&#39;claude-3-5-sonnet&#39;,<br>  &#39;Summarize this conversation. Include:<br>   **Problem:** [issue]<br>   **AI Help:** [assistance]<br>   **Time Saved:** [estimate]<br>   <br>   Conversation: &#39; || conversation::STRING<br>) AS summary<br>FROM CONVERSATION_LOG;</pre><p><strong><em>Some debugging tips based on my learning:</em></strong></p><blockquote>Test scripts manually before adding to hooks: echo ‘{“tool_name”:”Bash”}’ | ./your-script.sh</blockquote><blockquote>Use absolute paths for commands — relative paths may fail depending on working directory</blockquote><blockquote>Check Cortex Code logs if hooks aren’t firing as expected</blockquote><blockquote>Start with simple echo statements to verify your hook is being triggered</blockquote><blockquote>Ensure jq is installed for JSON parsing: brew install jq (macOS) or apt install jq (Linux)</blockquote><p><strong>Conclusion</strong></p><p>Hooks transform Cortex Code into YOUR personalized AI environment. Start with a simple SessionStart welcome hook, then build from there.</p><p><strong><em>What will you automate? Now go CoCo (CortexCode) and build something awesome!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58a53a4017cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>