wp-insert-formula

wp-insert-formula is a command for coding agents from Ganbin/4d-development-skill. It costs 0 tokens per session (1,358 once invoked), scanned A, original, MIT.

A document-editing command that inserts a calculated 4D formula into a 4D Write Pro document. The formula is evaluated and the inserted result is returned as a text range.

In plain words
What is it for?
Use it for calculated fields, generated reports, and documents whose content depends on application data.
Why use it?
It places dynamic values in documents without hard-coding the displayed result.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ganbin/4d-development-skill/wp-insert-formula
Clone the repo
git clone --depth 1 https://github.com/Ganbin/4d-development-skill

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wp-insert-formula

README.md
[![agentmods](https://agentmods.dev/badge/commands/ganbin/4d-development-skill/wp-insert-formula.svg)](https://agentmods.dev/commands/ganbin/4d-development-skill/wp-insert-formula)
Your own site
<a href="https://agentmods.dev/commands/ganbin/4d-development-skill/wp-insert-formula"><img src="https://agentmods.dev/badge/commands/ganbin/4d-development-skill/wp-insert-formula.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,358 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01358
Opus 5 $0.00000 $0.00679
Sonnet 5 $0.00000 $0.00272
Haiku 4.5 $0.00000 $0.00136

Measured 2d ago against content hash ef59f997072d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

wp-insert-formula scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/WritePro/commands/wp-insert-formula.md · 138 lines

How it starts

The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Parameter Type Description
targetObj Object Range or element or 4D Write Pro document
formula Object Formula object OR Object with formula and name properties
mode Real Insertion mode
rangeUpdate Real Includes or excludes the inserted content within the range
Function result Object Text range object reprsenting the result of the formula

Description

The WP Insert formula command inserts a formula in targetObj according to the specified insertion mode and returns the resulting text range.

In the targetObj parameter, you can pass:

  • a range, or
  • an element (table / row / cell(s) / paragraph / body / header / footer / section / subsection / inline picture), or
  • a 4D Write Pro document.

In the formula parameter, pass the 4D formula to evaluate. You can pass:

Property Type Description
name Text Name to display for the formula in the document
formula Object The formula object created by the Formula or Formula from string command

When you use an object with a formula name, this name is displayed in the document instead of the formula reference when formulas are displayed as reference, and in the formula tip when displayed as value or symbols. If the name property contains an empty string or is omitted, it is removed from the object and the formula is displayed by default. For more information, see the Managing formulas page.

In the mode parameter, pass one of the following constants to indicate the insertion mode to be used:

Constant Type Value Comment
wk append Integer 2 Insert contents at end of target
wk prepend Integer 1 Insert contents at beginning of target
wk replace Integer 0 Replace target contents
  • If targetObj is a range, you can use the optional rangeUpdate parameter to pass one of the following constants to specify whether or not the inserted formula is included in the resulting range:
Constant Type Value Comment
wk exclude from range Integer 1 Inserted contents not included in updated range
wk include in range Integer 0 Inserted contents included in updated range (default)

If you do not pass a rangeUpdate parameter, by default the inserted formula is included in the resulting range.

  • If targetObj is not a range, rangeUpdate is ignored.

Read the full file on GitHub · 138 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 138 lines · 0 tokens per session scan A ef59f997072d

Subscribe to this mod's changes

wp-insert-formula is a command published in the GitHub repository Ganbin/4d-development-skill (9 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,358 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.