I'll give it a go (or at least, ELI15):
A balanced transaction
Your example entry is not complete, in double entry accounting terms. It's not clear what it means. Here's a conventional double entry for a food purchase:
2024-09-01 buy food
assets:checking $-10
expenses:food $10
(A checking account is an asset, not a liability, so I've corrected that.) This is a complete journal entry for a transaction, recording the source account and destination account of the money. (In double entry accounting, spending categories and income categories are also accounts.) By requiring the transaction's inflow(s) and outflow(s) to sum to zero, we can be sure all money moved is accounted for, without any disappearing into or appearing out of thin air.
A separate budget envelope
Separately, you are also wanting to keep track of the balance remaining in a budget envelope. "budget:food" is not part of the five standard account categories (assets, liabilities, equity, revenue, expenses), so in accounting terms it's imaginary. That's allowed, but this new budget:food posting needs something to balance it - a fourth (dummy) posting:
2024-09-01 buy food
assets:checking $-10
expenses:food $10
budget:food $-10
budget used $10
Or, less verbosely, you can mark it as an unbalanced posting exempt from double entry accounting, by parenthesising the account name (a special feature of ledger and hledger):
2024-09-01 buy food
assets:checking $-10
expenses:food $10
(budget:food) $-10
Integrated budget envelopes
There's another solution, which appears if you try to track things very literally and accurately (always a good tactic when things are unclear). Imagine you are doing actual envelope budgeting, and keeping your cash in physical envelopes. You'd have several assets:envelopes:* accounts representing these, and a food purchase would be
2024-09-01 buy food
assets:envelopes:food $-10
expenses:food $10
This records the source and destination of money, and also updates your budget envelope balance, at the same time (because the source is the budget envelope). The budget envelopes are integrated within your normal asset accounts.
You can use the same approach with a checking account. Your bank probably doesn't let you easily create actual checking subaccounts, but that's fine, they can exist only in your accounting system:
2024-08-31 fill budget envelopes for the coming month
assets:checking
assets:checking:food $200
assets:checking:rent $1000
; etc.
2024-09-01 buy food
assets:checking:food $-10
expenses:food $10
In the real world, the food transaction's source is the checking account, but in your accounting the source is the (imaginary) checking:food subaccount. Accounting software like hledger, ledger and beancount will still show the correct balance for assets:checking, since they aggregate subaccount balances.
Updating integrated budget envelopes when spending from elsewhere
If you spend from a different checking account, cash, or a credit card, how can you update envelope balances ? You could maintain additional budget envelopes under those accounts, but that would be complicated. More simply, you could restrict yourself to spending mainly from the checking account.
Otherwise, you can add a pair of postings to update the budget envelopes, like this:
2024-09-01 buy food
assets:cash $-10
expenses:food $10
; deduct from food budget (return it to unbudgeted funds)
assets:checking:food $-10
assets:checking $10
Too much work ?
Some people use auto posting rules to automate adding budget-related postings.
If envelope budgeting is too much work or not the best fit, remember goal budgeting is an alternative.