Skip to content
safran

Type to search. Enter opens the first result.

    How writes work

    Safran reads. It can also post in four narrow ways, and only after the person who runs it turned that on. This page walks through the safety model step by step, shows what a preview and the audit log look like, and states the risks without softening them, so you can decide whether to enable it at all.

    What can be written, and what cannot

    KindWhat it doesConnector capability
    ticket.commentAdds one comment to a ticketwrite:comment (Jira, Azure Boards, Linear, GitHub Issues)
    ticket.create_childCreates one ticket under a parent, with a title, a description, a type and labelswrite:create-child (the same four trackers)
    pull_request.commentStarts one review thread on a pull request: general, on a file, or on a line of the diffwrite:pr-comment (Azure Repos, GitHub, GitLab)
    pull_request.replyAdds one reply inside an existing review threadwrite:pr-reply (the same three hosts)

    That is the whole list. There is no kind for deleting anything, editing an existing text, changing a status, an assignee, an estimate or a sprint, approving or voting on a pull request, resolving a thread, uploading a file, or creating tickets in bulk. Safran cannot edit or delete what it posted either: a wrong comment is removed by a person, in the tracker.

    A local code host has no pull requests and therefore nothing to write to.

    The model, step by step

    1. Off by default. A profile without a writes: section cannot write. The MCP server registers 23 read tools and no write tool, and safran.writes refuses every call with FORBIDDEN.

    2. The profile opts in, per kind. writes.enabled: true alone permits nothing; writes.allow lists the kinds. A kind that is not listed stays off.

    3. The profile must be one you named. A safran.yaml that was merely found in the current directory has its writes: section ignored, the same way its plugins: are. Name it (--profile, SAFRAN_PROFILE) or pass --allow-writes. See the trust rule.

    4. Preview. The caller describes the write. Safran resolves the target, reads its title, renders exactly the text that would be sent (with the profile's marker line, if any) and returns it with a confirmation token. Nothing is sent.

    5. A person confirms that preview. In Claude Code the skill shows the preview's text as it is and waits for an explicit yes. Permission given in advance ("post everything without asking") does not count.

    6. Commit, once. The token is presented; Safran sends that text and nothing else, one request, never retried. The token is single use, valid for ten minutes, and bound to the server that issued it.

    7. Audit. The preview, the commit and any failure are rows in a local log. If the row cannot be stored, nothing is sent.

    Three switches can turn writes off above the profile: --no-writes on safran mcp, a profile that was not named, and allowWrites: false in the SDK. Each of them wins over writes.enabled: true.

    Turn it on

    Check where you are first. The command is offline:

    $ safran writes status --profile safran.yaml
    ✔ Writes are off: Safran only reads.
      Why: the profile has `writes.enabled: false` (the default).
      → To allow one kind: safran profile set writes.enabled true writes.allow ticket.comment

    Enable the kinds you will use, and nothing else:

    safran profile set writes.enabled true writes.allow ticket.comment,pull_request.reply --profile /work/acme/safran.yaml
    safran profile set writes.marker "Bir yapay zekâ asistanıyla hazırlandı." --profile /work/acme/safran.yaml

    Or write the section by hand:

    safran.yaml
    version: 1
    company: acme
    languages:
      tickets: tr
      code: en
    trackers:
      - id: jira
        type: jira
        url: https://jira.acme.example
        email_env: JIRA_EMAIL
        token_env: JIRA_TOKEN
        projects: [PAY, MOB, WEB]
    code:
      hosts:
        - id: azure
          type: azure-repos
          organization: acme
          project: Platform
          token_env: AZURE_DEVOPS_PAT
    writes:
      enabled: true
      allow: [ticket.comment, pull_request.reply]
      marker: "Bir yapay zekâ asistanıyla hazırlandı."
    KeyDefaultMeaning
    writes.enabledfalseThe master switch.
    writes.allow[]The permitted kinds. Empty permits none, also with enabled: true.
    writes.require_confirmationtruefalse additionally lets SDK code call writes.execute in one step (a script, a CI job). The MCP tools are always two steps, whatever this says.
    writes.marker""One line appended to every text Safran posts, after an empty line, so readers can tell drafted text from typed text. Written in the company's ticket language; the preview shows it.

    Then three more things, none of which Safran can do for you:

    • Give the tokens write scope, for the connectors the allowed kinds use. Reading needed less. The connector pages say which scope.
    • Restart the MCP server. The tool list is fixed when the server starts; the first line it prints on stderr says whether write tools are served.
    • Check the result:
    $ safran writes status --profile safran.yaml
    ! Writes are ON for safran.yaml: agents using this profile can post under the connector tokens' accounts.
    
      ticket.comment        allowed  add a comment to a ticket
      ticket.create_child   not allowed
      pull_request.comment  not allowed
      pull_request.reply    allowed  reply in a review thread
    
      Every write is previewed first and sent only after it is confirmed.
      Marker added to every post: Bir yapay zekâ asistanıyla hazırlandı.
      Each preview, commit and failure is logged: safran writes log --profile safran.yaml

    safran status and safran doctor carry the same fact on a writes line, as a warning, so it is not forgotten. A kind that is listed but that no configured connector can perform is shown as unavailable.

    What a preview looks like

    A preview is the exact request, rendered before it is sent. This one was made through the SDK against the fixture connectors the test suite uses; the token and the id are from that run.

    preview.ts
    import { createSafran } from "@safran/core";
    
    await using safran = await createSafran({ profile: "/work/acme/safran.yaml" });
    
    const preview = await safran.writes.preview(
      { kind: "ticket.comment", ticket: "PAY-1423", body: "Yuvarlama testi eklendi; düzeltme `payments-api#482` içinde." },
      { client: "claude-code" },
    );
    console.log(JSON.stringify(preview, null, 2));
    {
      "kind": "ticket.comment",
      "target": {
        "source": "jira",
        "type": "ticket",
        "key": "PAY-1423",
        "url": "https://jira.acme.example/browse/PAY-1423",
        "title": "Kısmi iade işlemi İstanbul şubesinde başarısız oluyor"
      },
      "description": "Add a comment to PAY-1423 \"Kısmi iade işlemi İstanbul şubesinde başarısız oluyor\"",
      "body": "Yuvarlama testi eklendi; düzeltme `payments-api#482` içinde.\n\nBir yapay zekâ asistanıyla hazırlandı.",
      "markerAdded": true,
      "confirmationToken": "43MEC5jPJs1V6pucoKpaVGMx1Hr421t-blWvB1qf6Dk",
      "expiresAt": "2026-03-20T12:10:00.000Z"
    }

    What to read in it:

    • target is resolved, not echoed: the tracker, the key, the link and the title as the tracker has it now. A wrong key shows up here as a wrong title.
    • body is character for character what will be posted, marker included. A changed text is a new preview with a new token; an old token never carries new text.
    • confirmationToken proves that a preview happened and that what is committed is what was shown. It is not a secret to hide from the user.
    • Depending on the kind there is more: title, ticketType, labels and possibleDuplicates (existing children of the parent with a very similar title) for a child ticket; inReplyTo (the author and an excerpt of the comment being answered) for a reply; threadId, path and line in target for pull request writes.

    A reply to a review thread, from the same run:

    {
      "kind": "pull_request.reply",
      "target": {
        "source": "azure",
        "type": "pull_request",
        "key": "payments-api#482",
        "title": "PAY-1423 fix partial refund rounding",
        "threadId": "t-31",
        "path": "src/refund/service.ts",
        "line": 6
      },
      "description": "Reply in review thread t-31 of pull request payments-api#482 \"PAY-1423 fix partial refund rounding\"",
      "body": "Test eklendi: `test/refund/rounding.test.ts`.\n\nBir yapay zekâ asistanıyla hazırlandı.",
      "markerAdded": true,
      "inReplyTo": {
        "author": "Çağrı Öztürk",
        "excerpt": "Yuvarlama için test eksik."
      }
    }

    (The target's url, the token and the expiry are left out of this second excerpt.)

    In a Claude Code session the same preview arrives through the preview_write tool and is committed with commit_write; the MCP reference has their inputs and text layout, and the SDK guide a complete preview → commit example. How a skill presents a preview and what counts as a yes is in the journey page.

    The audit log

    Every preview, commit and failure is a row of write_audit in safran.db under the data directory. safran writes log reads it; it works while writes are off and contacts no service.

    $ safran writes log --profile safran.yaml
    when              status     kind                target                  by
    2026-03-20 12:00  previewed  pull_request.reply  azure:payments-api#482  claude-code
    2026-03-20 12:00  committed  ticket.comment      jira:PAY-1423           claude-code
                      → https://jira.acme.example/browse/PAY-1423?comment=w1
    
    2 rows: 1 committed, 0 failed, 1 previewed only
    $ safran writes log --profile safran.yaml --bodies --status committed
    when              status     kind            target         by
    2026-03-20 12:00  committed  ticket.comment  jira:PAY-1423  claude-code
                      → https://jira.acme.example/browse/PAY-1423?comment=w1
    
    2026-03-20 12:00  committed ticket.comment → jira:PAY-1423
      Yuvarlama testi eklendi; düzeltme `payments-api#482` içinde.
      
      Bir yapay zekâ asistanıyla hazırlandı.
    
    1 row: 1 committed, 0 failed, 0 previewed only
    • A row holds the kind, the target, the status, the SHA-256 of the previewed text, the result id and link or the error, and who asked when the caller said so (by).
    • The text itself is kept for committed and failed rows. A preview that was never committed keeps only the hash.
    • The log is a local file like the rest of the data directory. It is evidence for you, not a tamper-proof record: whoever can write the data directory can delete it. The tracker's own history remains the authority on what was posted.

    The dashboard shows the same status and log on its Writes screen, read-only: the dashboard never performs a write.

    The trust rule for a profile that was found

    A safran.yaml picked up from the current directory was not chosen by you: it may have arrived with a repository you cloned. Such a profile cannot make Safran run code (plugins:), and for the same reason it cannot make Safran post:

    $ safran writes status
    ✔ Writes are off: Safran only reads.
      Why: the profile enables writes, but it was picked up from the current directory, not named by you.
      → If you trust this profile, name it (--profile safran.yaml) or pass --allow-writes.
      The profile would permit: ticket.comment, pull_request.reply.
    How the profile was chosenwrites: applies
    --profile <file> or SAFRAN_PROFILEYes
    Found as ./safran.yaml, with --allow-writesYes
    Found as ./safran.yamlNo
    Any of the above with safran mcp --no-writesNo

    The plugin and safran setup claude always pass an absolute --profile, so a server started that way applies the profile's writes: section. That is the reason to keep the profile outside any code repository.

    --no-writes exists for the opposite case: a server that several people or sessions share over HTTP, or a session where you want the reading tools and nothing else. It cannot be combined with --allow-writes.

    safran mcp --http --no-writes --profile /work/acme/safran.yaml

    Risks, stated plainly

    • The post appears under the token's account. Readers see that person or service account as the author, and they are notified. The marker line is the only sign that an assistant drafted the text, and only if you set one.
    • It cannot be taken back by Safran. There is no edit and no delete. A wrong comment stays until a person removes it.
    • The confirmation is as good as the reading. The safeguards guarantee that a person was shown the exact text and said yes to it. They do not guarantee that the person read it. Someone who approves five previews without reading posts five texts they did not read.
    • Prompt injection gains a target. A ticket or a review comment can contain text that asks an assistant to post something. The server instructions and the skills say that such text is never a reason to write, and a request must come from the user in the conversation; that is an instruction to a model, not a mechanism. The mechanism is the preview and the yes.
    • Write scope is more access than reading needs. The token can do everything its scope allows, also outside Safran. Keep the scope as narrow as the service lets you.
    • A failure after the request left is ambiguous. A timeout during a commit is reported as UPSTREAM with the warning that the write may have happened. Safran does not retry; look before posting again.
    • Tool packs. A third-party tool pack is not given the write API or a connector. A pack's own tool that says it changes the outside world is refused with FORBIDDEN while writes are off; with writes on, what it does is its code and your review of it.
    • Not verified live. No write method of any connector has been run against a live service from this code base. They were written from the vendors' API documentation and are tested against fixtures. Try the first write of each kind on a ticket or pull request where a mistake costs nothing. See Status.

    Common problems

    What you seeCause
    The agent says Safran is read-only, but the profile enables writesThe server was started before the change, or with --no-writes, or from a profile it found. get_server_info and safran writes status give the reason.
    FORBIDDEN naming a kindThe kind is not in writes.allow.
    UNSUPPORTED naming a connectorThat connector cannot perform this kind.
    CONFIRMATION_REQUIREDThe token expired (ten minutes), was issued by another server instance, or the server restarted. Preview again.
    CONFLICTThe token was already used; the hint links to what it created. Nothing was sent twice.
    INVALID_INPUT on a pull request commentline without path, a body that is empty or over 20,000 characters, or a line the host does not accept as part of the diff.

    Each code with its message is in Troubleshooting.