AI Lab: Let Claude Code Run Your EPM Automate Jobs, Without Handing Over the Keys

November 13, 2026

Every EPM team I have worked with runs on two things: a folder of EPM Automate scripts, and a runbook that lives in one administrator’s head. Did the overnight rules finish? Which one failed, and why? Rerun the integration with Replace, never Append. Take a snapshot before anyone touches metadata.

Claude Code can do that work now. It reads the job console, explains a failed rule in plain English, and reruns it with the right runtime prompts. Before I let it near an environment, though, I want a clear answer to one question: what stops it from typing epmautomate recreate -f?

This post opens a new series, the AI Lab, next to the EPM Lab and the Groovy Lab. It picks up where The Evolution of EPM AI left off: agents that act, built by hand, with the controls a finance leader can sign off on. Over the next posts: how to choose between Oracle’s own agents and your own, a read only MCP server for EPM, securing an agent that can see your forecast, and writing Groovy with a coding agent. The code for the series lives in one GitHub repository.

Here the agent runs the runbook against a test environment, with five controls between it and your application. Only one of them is enforced by Oracle, and it is the one most people set up last.

Five controls, and which one actually holds

Control What it does What it holds against
1. The EPM account Oracle decides what the agent’s account may do Everything. Oracle enforces it, and nothing on your machine can change it
2. The sandbox The operating system cuts off the network and outside files for commands Claude runs Scripts the agent writes for itself. macOS, Linux, and WSL2 only
3. Permission rules Deny, ask, and allow rules in .claude/settings.json The commands as Claude normally writes them
4. The guard hook A script checks every EPM Automate call against a policy, and fails closed Operators, escapes, odd quoting, parameter files, the wrong password file or environment
5. The Skill The runbook, written down for the agent Nothing. It is knowledge, not control

Build them in that order. Most teams start with the Skill, because it is the fun part, and add the account last. That is backwards.

1. Start with the account, because it is the only real boundary

Give the agent its own account. Never a person’s account, and never a Service Administrator. Every EPM Automate command checks the role of whoever logged in, and that check happens inside Oracle, where no prompt, hook, or clever command can reach it.

Here is what each command in this runbook requires, from Oracle’s command reference:

Command Who can run it
login Service Administrator, Power User, User, Viewer
runBusinessRule Service Administrator, or Power User with launch access to the rule
runIntegration Service Administrator, Power User
exportJobConsole Service Administrator, or any application role with Jobs - View or Jobs - Manage
listFiles, downloadFile, exportSnapshot Service Administrator, or any application role with Migrations - Administer
importSnapshot, deleteFile Service Administrator, or any application role with Migrations - Administer
recreate, resetService Service Administrator only

The last row is the good news. An agent logged in as a Power User cannot recreate or restart your environment, whatever it tries. The two rows above it are the catch. Oracle’s granular roles are coarser than a runbook: the role that lets the agent download its own job console export is the same role that lets it import a snapshot over your application.

So decide it on purpose. For the setup in this post I use a Power User with launch access to a short list of rules, plus Jobs - View and Migrations - Administer, in a test environment only. Controls 2 to 4 exist to stop the snapshot import that role would otherwise allow. In production, I would not give an agent Migrations - Administer at all.

Three more choices on the account:

  • Create it in the test environment’s identity domain only. Then there is no production login for it to misuse, whatever happens on your machine.
  • Use an OAuth 2.0 refresh token instead of a password. Oracle recommends OAuth over basic authentication, and EPM Automate does not support basic authentication for users set up with multifactor authentication. There is a side benefit: addUsers, removeUsers, assignRole, and unassignRole require basic authentication, so an agent logged in with a token cannot run them.
  • You create the credential file, not the agent. The encrypt command takes the password or token as a plain command line argument. Run it yourself, in your own terminal, with an EPM Automate client from 26.09 or later. My post on the December .epw deadline explains why the client version matters. The agent never runs encrypt, and never reads the file.

One more about the machine. Run the agent under its own operating system user, on a machine that holds no other EPM credentials. Batch servers usually keep a Service Administrator’s .epw file for the nightly scripts. That is exactly the machine not to use.

2. The sandbox: no network for anything the agent writes

Claude Code can run its shell commands in a sandbox enforced by the operating system. Network traffic goes through a proxy that allows only the domains you list, and the list starts empty. Two details decide how to use it here.

First, EPM Automate is a Java program, and Java does not pick up proxy settings from environment variables unless it is told to. Claude Code’s documentation warns that a tool which ignores those variables cannot connect from inside the sandbox, even to an allowed host. So I run EPM Automate outside the sandbox and keep everything else inside it, with no network unless you approve a host:

"sandbox": {
  "enabled": true,
  "allowUnsandboxedCommands": false,
  "excludedCommands": ["epmautomate *"],
  "network": {
    "allowedDomains": [],
    "deniedDomains": ["example.epm.us-phoenix-1.ocs.oraclecloud.com"]
  }
}

That looks backwards, and it is the stronger arrangement. The one program that can reach EPM is the one whose every call passes the guard hook, with its login pinned to the test account. A script the agent writes for itself, say Python calling the REST API, runs in the sandbox, and the production host is on the denied list, which is refused in every permission mode. Any other host prompts you, unless you also set strictAllowlist to true under sandbox.network in your user settings, which refuses it outright; a project file cannot set that one. allowUnsandboxedCommands: false removes the escape hatch where Claude retries a blocked command outside the sandbox.

Be clear about what this means for EPM Automate itself: it runs outside the sandbox, so the guard hook’s login pin is the only network check on it. That is why the account comes first.

Second, the sandbox runs on macOS, Linux, and WSL2. On native Windows, Claude Code runs commands unsandboxed, and many EPM Automate servers are Windows machines. You have two options. Run Claude Code inside WSL2 with the Linux EPM Automate client, which needs Java: from 26.10, on Linux and UNIX, it uses JDK 21 if it is available and specified in JAVA_HOME, and JDK 17 support is deprecated in 27.01. Or accept that on Windows, the account, the rules, and the guard hook carry the load.

3. Permission rules: the first filter

The rules go in .claude/settings.json in the project folder. Deny wins over allow, and an ask rule prompts you even when an allow rule also matches. Here is the core of the file:

"permissions": {
  "disableBypassPermissionsMode": "disable",
  "disableAutoMode": "disable",
  "blockReadsOutsideWorkingDirectories": true,
  "allow": [
    "Bash(epmautomate login svc_epm_agent C:/secure/svc_epm_agent.epw https://example-test.epm.us-phoenix-1.ocs.oraclecloud.com)",
    "Bash(epmautomate logout)",
    "Bash(epmautomate listFiles)",
    "Bash(epmautomate downloadFile *)",
    "Bash(epmautomate exportJobConsole *)",
    "Bash(epmautomate getSubstVar *)"
  ],
  "deny": [
    "Read(**/*.epw)",
    "Bash(epmautomate encrypt *)",
    "Bash(epmautomate recreate *)",
    "Bash(epmautomate resetService *)",
    "Bash(epmautomate importSnapshot *)",
    "Bash(epmautomate deleteFile *)",
    "Bash(epmautomate runDailyMaintenance *)",
    "Bash(epmautomate addUsers *)",
    "Bash(epmautomate removeUsers *)",
    "Bash(epmautomate assignRole *)",
    "Bash(epmautomate unassignRole *)"
  ],
  "ask": [
    "Bash(epmautomate runBusinessRule *)",
    "Bash(epmautomate runIntegration *)",
    "Bash(epmautomate exportSnapshot *)"
  ]
}

What the less obvious lines do:

  • The login rule is an exact match. Only the agent’s own user, its own password file, and the test URL run without a prompt. Any other login prompts you, and the guard hook denies it first.
  • The two disable settings stop anyone from starting a session in bypass mode, which skips the prompts, or in auto mode, which hands them to a classifier.
  • blockReadsOutsideWorkingDirectories makes Claude’s file tools refuse anything outside the project folder, and the shell commands Claude Code recognizes as file reads prompt you. Keep the credential file outside the project. The Read rule covers any copy that lands inside, and the guard hook refuses any shell command that names a .epw file.
  • The shipped file repeats every rule as PowerShell(...). On Windows, Claude Code can use a PowerShell tool as well as Bash, and Bash rules do not apply to it. Use the PowerShell tool there: Claude Code’s Bash tool on Windows is Git Bash, which finds EPM Automate only as epmautomate.bat, so rules written for epmautomate would never match.

These rules have a limit, and Claude Code’s documentation states it plainly: a deny rule “isn’t a security boundary around the program.” Rules match the text of the command Claude writes. A rule for epmautomate recreate does not match /opt/epmautomate/bin/epmautomate.sh recreate -f, or the same command wrapped in sh -c. EPM Automate is relaxed about spelling, too: Oracle’s own documentation writes the same command as downloadFile on one page and downloadfile on another. Rules are a fast first filter. The next control catches the rest.

4. The guard hook: a policy that fails closed

A hook is a script Claude Code runs at a fixed point. A PreToolUse hook runs before every tool call, receives the call as JSON, and can deny it, send it to a person, or let the normal rules decide. This one inspects every Bash, PowerShell, and Monitor call, and any MCP tool call that carries a command, and acts on any command that mentions EPM Automate or a .epw file:

  • The call must be one plain EPM Automate invocation, written with a short list of safe characters: letters, digits, spaces, quotes, and . , : / = + { } # _ -. Bash, PowerShell, and cmd.exe each read quotes, escapes, and operators differently, and a review of an earlier version of this hook showed "x&whoami" running whoami through cmd.exe. So the hook does not try to list what is dangerous. It allows only what EPM Automate needs. Wrappers such as sh -c or cmd /c are denied too.
  • The price is substitution variables: &CurYr is blocked. The Skill tells the agent to read the value with getSubstVar first and pass the member name, which is also easier to check in the prompt.
  • The program must be EPM Automate by its bare name, found on your PATH: epmautomate, epmautomate.sh, or epmautomate.bat. A path such as ./epmautomate.bat is denied, because the agent could write a script of its own with that name. If you run EPM Automate by full path, set that exact path as program in the policy and add it to the sandbox’s excludedCommands as well. The command is normalized, so RECREATE in capitals lands on the same check.
  • login must be exactly the agent’s user, its password file, and an environment on the policy. A different file, a password typed in place of the file, a path with .. in it, or production is denied. With an OAuth token, EPM Automate ignores the user name and takes the identity from the token, so the password file is what really pins the account.
  • Parameter files (-p) are denied on every command. EPM Automate reads arguments from the file, which would hide the real login or rule from the hook and from you.
  • A .epw file may appear only in login.
  • Commands on the allow list pass to the normal rules. Commands on the ask list go to a person. Anything else is denied, including every command Oracle adds next year.
  • If the policy is missing or the input is unreadable, the call is denied. If the hook itself errors, it exits with code 2, which blocks the call.
  • Every decision is appended to an audit log. A denied call is logged with its command name only, because a refused call can carry a password or an auth token in any position. On allowed and asked calls, the password positions of login and the Object Storage copy commands, everything after encrypt, and secret key= style arguments are redacted. A wrapped command the hook could not inspect is logged as [unparsed] rather than in full.
  • The check is deliberately blunt: any command that mentions EPM Automate is held to it, so even git commit -m "pin the epmautomate login" is denied. Reword the message; do not loosen the hook.

The policy is a small JSON file next to the hook:

{
  "login": {
    "user": "svc_epm_agent",
    "password_file": "C:/secure/svc_epm_agent.epw",
    "allowed_urls": ["https://example-test.epm.us-phoenix-1.ocs.oraclecloud.com"]
  },
  "allow": ["login", "logout", "listFiles", "downloadFile", "exportJobConsole", "getSubstVar"],
  "ask": ["runBusinessRule", "runIntegration", "exportSnapshot"],
  "audit_log": ".claude/epm-audit.jsonl"
}

The hook is registered in the same settings.json. The matcher covers the three built in tools that run commands, plus every MCP tool. That last part matters in the Claude desktop app, whose terminal tool types a command into your own shell, outside the sandbox. The hook checks any MCP call that carries a command and ignores the rest:

"hooks": {
  "PreToolUse": [
    {
      "matcher": "Bash|PowerShell|Monitor|mcp__.*",
      "hooks": [
        {
          "type": "command",
          "command": "python",
          "args": ["${CLAUDE_PROJECT_DIR}/.claude/hooks/epm_guard.py"],
          "timeout": 10,
          "onFailure": "block"
        }
      ]
    }
  ]
}

onFailure matters. By default, a hook that times out on PreToolUse does not block the call, and an exit code of 1 counts as a non blocking error. A guard that fails open is not a guard. The onFailure setting needs Claude Code v2.1.295 or later.

The full hook is about 200 lines of standard library Python. Two parts carry most of the weight. The first is the character rule, and the second is the login pin:

# A call that mentions EPM Automate may use only these characters. Bash, PowerShell, and cmd.exe each
# read quotes, escapes, and operators differently, so instead of listing what is dangerous, this allows
# only what an EPM Automate command needs: no & | ; < > ( ) $ ` \ % ^ @ or non ASCII characters at all.
# The cost: substitution variables such as &CurYr must be resolved first, with getSubstVar.
SAFE = re.compile(r"""[A-Za-z0-9 _.,:/=+{}#"'-]*""")


def check_login(tokens: list[str], login: dict) -> str | None:
    """Return a reason to deny, or None. Login must be exactly: epmautomate login USER FILE URL."""
    if len(tokens) != 5:
        return "Login must be exactly: epmautomate login USER PASSWORD_FILE URL, as set in epm_policy.json."
    _, _, user, pw_file, url = tokens
    # With an OAuth token in the file, EPM Automate ignores the user name, so the file is the identity.
    if user.lower() != str(login.get("user", "")).lower():
        return "Login is allowed only as the agent's own user in epm_policy.json."
    if not same_path(pw_file, str(login.get("password_file", ""))):
        return "Login is allowed only with the agent's own password file in epm_policy.json."
    urls = {u.lower().rstrip("/") for u in login.get("allowed_urls", [])}
    if url.lower().rstrip("/") not in urls:
        return "Login is allowed only to the environments in epm_policy.json."
    return None

The complete hook, the policy, the settings file with every Bash and PowerShell rule, the Skill, and the tests are on GitHub, ready to copy into a project.

I tested it offline with 82 checks that run it exactly as Claude Code does, one process per call with the call on stdin: allowed and asked commands, every denied shape above, the quoting and escaping tricks that fooled the earlier version, logins with the wrong file, through a parameter file, or to production, and the redaction of every secret it might see. The tests are in the repository.

The limit of a hook is the same as the limit of a rule, one level down: it reads the text of the call. A script that calls EPM Automate inside it, or shell quoting such as 'epm'automate, hides the name. Such a call still meets a permission prompt, because no allow rule matches it, and inside the sandbox it has no network. That is why the account comes first and the sandbox second.

5. The Skill: the runbook, written down

A Skill is a folder with a SKILL.md file. Claude Code lists every Skill’s description at the start of a session and loads the full instructions only when a request matches, so a long runbook costs nothing until it is needed. This one lives in .claude/skills/epm-automate/:

---
name: epm-automate
description: Run the Oracle EPM Automate runbook for the test environment. Use when asked whether last night's jobs or business rules worked, why a job failed, to rerun a business rule or integration, or to take a snapshot before a change.
argument-hint: "[what you want checked or run]"
---

# EPM Automate runbook

You operate Oracle Cloud EPM through the EPM Automate command line, for the test environment only.
The person you work with is the EPM administrator. You do the legwork and explain what you found; they
decide anything that changes the environment.

## Rules of the road

- Run one EPM Automate command per call. No chaining, pipes, redirects, variables, or parameter files
  (-p); the guard hook blocks them. To use a substitution variable, read its value with getSubstVar
  first and pass the member name, because & is blocked.
- On Windows, run EPM Automate through the PowerShell tool. Write paths with forward slashes.
- Report every command you ran and its exit code. Exit code meanings are in reference.md.
- Before each command that runs or changes something, say in one sentence what it will do and why.
- If the guard hook denies a call, do not look for another way to run it. Explain what you wanted to
  do and let the administrator decide.
- Figures, member names, and error text come from EPM output, quoted exactly. Never estimate them.

## Procedures

### Did last night's rules run?

1. Log in.
2. epmautomate exportJobConsole jobs.zip nDays=1 jobTypes=all jobStatusCodes=3,4,5,8,9 exportErrorDetails=true
3. epmautomate downloadFile jobs.zip, then unzip it locally and read the CSV and any error logs.
4. Report how many jobs failed or warned, and for each one the job name, the time, and the error in
   Oracle's own words. Then your reading of the likely cause, labeled as your reading.

The full file also covers the login line, rerunning a rule, rerunning an integration, and a snapshot before a change. A second file, reference.md, holds the exit codes and command syntax, and loads only when the agent needs it.

Two lines in it are worth copying into any agent instruction you write. “If the guard hook denies a call, do not look for another way to run it” keeps a denial from becoming a puzzle the agent tries to solve. The line requiring figures, member names, and error text to come from EPM output, quoted exactly, is the rule that keeps an agent’s report trustworthy.

The Skill tells the agent not to try. The hook stops it if it tries anyway. You want both.

A morning, end to end

I ask one question: did last night’s rules run? Claude Code logs in, exports the job console for the last day with error details, downloads it, and reads it. Two jobs stand out. A metadata import at 01:40 completed with warnings, and the revenue rule failed at 02:14 on an unknown member. The agent connects them: the member the rule needs was renamed by the metadata load. It labels this as its reading, quotes Oracle’s error exactly, and tells me the fix belongs in the rule, which it cannot edit from here.

Once the rule is fixed, it proposes the rerun with the exact runtime prompts, and the permission prompt waits for me. When I ask it to restart the environment because the morning felt slow, it declines: restarts are not in its runbook, and had it tried, the guard hook would have denied the call, as in Figure 2.

The legwork takes a minute. Every change still waits for a person.

Before you take this further

  • Test environment first, and for a while. The test only account and the pinned login are what make the experiment safe. Production stays a human runbook until you have weeks of audit log behind you.
  • Keep a person on every run. Leave runs on the ask list, and give the Skill no allowed-tools grants, which approve tools without a prompt for the turn that invokes the Skill.
  • Keep the controls out of the agent’s reach. Claude Code treats .claude as a protected path and asks before writing to it. For a team, put the hook and the deny rules in managed settings, which project settings cannot override. If allowUnsandboxedCommands: false moves there too, Claude Code stops reading the project’s excludedCommands, so move that line with it or EPM Automate cannot connect.
  • Reconcile the audit log with Oracle’s. The hook logs what the agent asked to do. The EPM job console and activity report record what actually ran. When they disagree, Oracle’s record wins.
  • Unattended runs are a different design. An agent that runs on a schedule with nobody watching needs its own controls. That comes later in this series.

An agent’s reach is the reach of the account you give it. Get the account right, then add the controls that catch mistakes, then teach it the runbook. Next in the AI Lab: Oracle’s own agents in AI Agent Studio, or your own agent with MCP, and how to choose.

Leave a Reply

Your email address will not be published. Required fields are marked *