AI Hero Club

Context Engineering · Lesson 8

Marked Complete by You0 / 8

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

Lesson Outline 7 subsections
Course Contents 8 lessons
Full course plan.
Context Engineering / Learning Plan ↗

LESSON 08 / 8Suggested study 140 minutes

Complete Delivery: Run and Modify from a Clean Directory

After importing a new notice, how do we verify that budgets, versions, citations and replay after reopening remain consistent?

3 Questions for This Lesson
  • From CLI to the complete chain of answers.
  • Complete durability, reopening, citation and unwinding of closed rings
  • Freezing of evidence and independent packaged course projects
Course Project ZIP ↓

Connect the Lessons into a Verifiable Deliverable

This chapter does not add new concepts, but transforms the first seven chapters into items where readers can run, modify, or interpret from a new directory. The entry border is Python, reading JSON and dictionaries; there is no requirement to purchase model services or download weights. The ability to do it is to give a set of textual information and tasks, import events, restore status, construct date view, search, compress, actual word-splitting budgets, generate reference results, verify support, save copying, and repeat the same process as when updated/revoked. It is a controlled field information compiler, not an open domain chat robot.

The download package context.py is the mechanism realization, run.py is the unified entrance, tests.py is the acceptance, vendor/tokenizer.py and data/tokenizer.json It's a packaged subword to make and freeze the table. data/docs In this post, the blog evidence/final It's a final experiment, and the development series is history. Students do not read web code or any brother's courses, and author chapter audits are not dependent on running. ZIP It is an executable product, which is linked to the list and not relied on each other in secret.

Call order starts with a clear contract. query provides questions, Fields specifies the field to be extracted, limit and reserve gives capacity, as_of determines the prefix of the event, at determining the date of the business, and scope determines the range of memory. Apply validate_task to replay the event after it is returned, and then gets unts and compressed checks; rank automatically calculates the word fractions, pack uses the full Wire; Answer is only visible and valid. The output of each step is the next auditable input.

Worked Example 1: From a Fresh Directory to a Specific Citation

First perform demo using an output directory that does not have a memory. sqlite. It reads from the real Markdown file, rather than directly importing a set of manual answers; each import calculates source file SHA and writes to SQLite by event. Eighteen jobs return the specified prefix, the main configuration is time-current uses the first 12 events and fixed 14 days, and the time to produce schedule@2: 3. This reference can be returned to the schedule-v2.md third line review. The main cost, JSON structure, source and special tags are entered into the actual code, without using handwritten “Paragraph30token” as a cost.

The time question in the actual result is 958 and the output is 89, with a capacity of 240 and 1500. 958+240=1198≤1500958+240=1198\leq1500, indicate that access is set to maximum permissible output; re-checking 89≤24089\leq240 It's gotta be real. 958+89=1047≤1500958+89=1047\leq1500. This is a precise volume deduction, separated from correct references. Supports checking for the current source version, SHA, line 3 word-by-word and visible group verification. Readers should see the true capacity, support the true and overlay one in their reports, not just the state of “answered”.

Terminal CommandRuns the project directory after decompressing the item. Learner-run and larner-mory. sqlite must be new; repeating the imported library will be rejected.
python3 tests.py
python3 run.py demo --output learner-run
python3 run.py import --db learner-memory.sqlite
python3 run.py query --db learner-memory.sqlite --task-id time-current
python3 run.py query --db learner-memory.sqlite --task-id conflicting-time
python3 run.py replay --db learner-memory.sqlite --as-of 6

Load Your Own Tasks Beyond the Fixed Demonstration

The query command supports the task-id and the task-file. The smallest custom file needs query,fields, licit, reserve; it can be clearly given as_of=12 to see the non-conflict notification. query must be non-empty, up to 4096 characters, Fields non-empty and field names non-repeated, budget is real, not integer True/False. The date can be resolved as ISO On a month-on-year basis, an unknown field is rejected to prevent the user from believing that a misspelled parameter is in effect. The task field and the business data are separated and the external quate is not covered as the task parameter.

Direct CLI encounters schema or database errors that show anomalies and do not disguise as normal responses; the developer simply converts BudgetError to corresponding task status. If it is packaged into a web page API, the developer should divide ContractorError into a stable response to internal errors and add authentication, and send and input size control; this server is not available in the current course and “Local command line can run” will not be used as an alternative to real service testing. Readers should first be able to explain local results and then decide whether to introduce external models or networks.

Run in the Project DirectoryProject Directory: Really write to custom JSON, and the sub-process CLI enters the same pipe without bypassing parameters.
import json,pathlib,tempfile,subprocess,sys
from run import setup,ROOT
with tempfile.TemporaryDirectory() as d:
    d=pathlib.Path(d);db=d/'m.sqlite';repo=setup(db);repo.db.close()
    task={'query':'活动地点','fields':['活动地点'],'limit':1500,'reserve':240,'as_of':12}
    f=d/'task.json';f.write_text(json.dumps(task,ensure_ascii=False),encoding='utf-8')
    result=subprocess.run([sys.executable,str(ROOT/'run.py'),'query','--db',str(db),'--task-file',str(f)],capture_output=True,text=True,check=True)
    row=json.loads(result.stdout)
    assert row['compiled']['result']['coverage']==1
    assert row['compiled']['result']['claims'][0]['id']=='location@2:3'
print('custom task CLI checked')

Worked Example 2: Approval, Update, and Revocation

The preference expressed in the initial complete library has been withdrawn. Readers add it to the temporary library version=3 、 scope=club 、 approved=true The memory. “I'm going to start with evidence.,Further explanation of budget”, close the connection and re-open it. Ask the key when units only exposes the third edition of this memory in the current range; it enters the actual wire, is extracted, is checked through source and view. Output references memory/club/ Expression of preferences@ 3. Not program printing “Remember that.” Even if sustained, the database must be re-established from the log and detected.

Then add revoke_mory to the same key, scope and version=3, asking again about abstain. Old v1 and v2 will not come back, but historical events will still be viewed through a clear as_of. The entire loop consists of approval intent, actual state writing, re-opening, budget construction, source validation and post-record recovery; only one Python dictionary can be displayed. Nor does it automatically write the answer into a new memory, avoiding the model from making “Facts” from its unsupported text and using it to quote itself.

Run in the Project DirectoryProject catalogue: Complete sustainability and cancellation of closed rings, temporary library not contaminating frozen evidence.
import pathlib,tempfile
from context import Repository,compile_context
from run import setup,load_tokenizer
t={'query':'表达偏好','fields':['表达偏好'],'limit':1500,'reserve':240}
with tempfile.TemporaryDirectory() as d:
    db=pathlib.Path(d)/'m.sqlite';r=setup(db)
    r.append({'type':'memory','key':'表达偏好','value':'先列证据,再解释预算。','scope':'club','version':3,'approved':True});r.db.close()
    r=Repository(db);a=compile_context(r.replay(),t,load_tokenizer())
    assert a['result']['claims'][0]['id']=='memory/club/表达偏好@3'
    r.append({'type':'revoke_memory','key':'表达偏好','scope':'club','version':3})
    assert compile_context(r.replay(),t,load_tokenizer())['result']['status']=='abstain'
    r.db.close()
print('persist, reopen, cite, revoke, abstain')

Examining a Failed Repair Workflow

The records of head, compressed=true, task=project are found at final/evaluation.json. Staple all source files and change the selection policy to ran. Only the same task is rerun: if the target moves into the list and restores coverage=1, the difference can be attributed to the stated selection rules instead of “It's a more intelligent model.”. Resume the header as a negative contrast; do not declare all configurations full after the failed task has been removed from the task sheet. The full eighteenth question should still be rerun, confirming that local restoration has not returned to the outdated, conflicting and scope issues.

If you want to modify the information itself, import a new version instead of text in SQLite. The event summary is bound to the old text, direct replacements destroy the chain or make the source summary unmatched. The original Markdown file changes but does not re-import and does not automatically change the stored information: this is a clear border for snapshoting external input. A new library can be created and a new list imported, a new code/data summary can be saved and a problem-by-issue report can be reported; the old experiment remains in the old directory and cannot be combined with the old model/selection results as “Same freeze.”.

What Counts as Completing This Course?

Twenty-two tests, containing non-single BPE prefixes, Unicode slices, source and visible support, tampering with summaries, historical revocation, expiry, future entry, conflict, schema and output preset. Reruning demo has obtained a comparison of eighteen main tasks and 108 hits, the head examination has retained a known failure, the evidence has been removed to zero, and the cutoff experiment is still one-third. The correct source code is two different checks from the packing independence, and students cannot recover without a single document.

The delivery statement should also list uncertified items: remote LLM NOT RUN Semantic vector search NOT IMPLEMENTED, general syntax compression, real source authentication not realized, multi-processed and power outages not measured. The full-bank conflict door is a precise field text comparison, without extraneous logic contradictions; the date metadata are provided by the author and are not available. “This Friday.” Auto-judgment. Integrity does not describe the system as anything, but rather allows readers to recreate their conclusions from the way they enter them and to specify precisely which assumptions each conclusion relies on.

The final project changes the context work from a drafting proposal to an object that can be checked: the permissible status determines the information field, the actual coding determines the capacity, the source and visible confluence decision can be stated, the event log determines history, and the fixed task determines the current acceptance conclusion. The criteria for completion of the course are to modify one of the links and predict which positive/negative contrast changes, then test the prediction using new question-by-question evidence; not to add ten slogans or to write a more elegant presentation.

File Inventories and Behavioral Reproduction Provide Different Evidence

The final project-receipt binds the current project source, data, and freezes the output and the chapter. Each entry is calculated using the actual document SHA. The list checks whether the downloaded document is in line with the audited construction, but it cannot be justified by a summary alone. The behaviour recovery still runs from the clean directory to the demo test. Conversely, the behaviour output does not mean that all documents remain the same: different notes or re-engineering may produce the same result. The course therefore saves the source list and the results of the operation, without mixing them into a vague assertion of “Exactly the same.”.

The modification experiment should change only one clear link. For example, the k constant of rank should be changed from 60 to 30, the information, tokenizer and capacity should be retained, and the name difference and the slected could be predicted; if the change is made in constant numbers without changing the outcome of the mission, the negative result should also be reported, rather than continue to change many until a successful case is found.

The reader should eventually be able to answer three receiving and inspection questions independently: which line of the answer is specific to which document; how this action is available on that date and in the prefix; and how much of the frozen word is used for complete input and actual output. If any answer can only be obtained by resorting to “The model should know.”, it means that the link to the controlled pipe is not closed. They do not automatically make the system a universal assistant, but they provide a stable set of interfaces and rebuttable assumptions for subsequent introduction of a stronger model, avoiding the effects remaining only in a beautiful demonstration.

TRY IT YOURSELF

Base: two-way capacity check

Enter 958, reserve 240, actual output 89, capacity 1500, and write access and total volume check.

Hint 1
The pre-implementation pre-encumbrance access and post-implementation actual output restrictions are to be stated separately.
Hint 2
+ R C for a prior input, and R for an output, with an actual total of two different types; support and integrity check separately.
Compare with the Solution
First 958+240 = 1198 1500 and then 89240, so the actual 958+89 = 1047 1500. Capacity creation still requires a different source support and task coverage.

TRY IT YOURSELF

Step: sustaining evidence

Post-print “Remembered” program closed. Why not?

Hint 1
How does printing messages differ from the database submission? What should be observed after the process exits?
Hint 2
Closes the reopening of the database and replays the same version of memory after the submission of the event and cancels the check.
Compare with the Solution
Prints are not returned to the library. The event should be submitted by the controlled append, restarting SQLite and replaying, and searching from unts for the same version of the same memory.

TRY IT YOURSELF

Challenges: project independence

Student ZIPRites import to Tokenizer in another course in the work area. Author machine pass.

Hint 1
What is the potential dependence of the author's successful environment on the compressed package?
Hint 2
Perform a check from the new decompression directory to confirm that essential source codes and instructions, such as tokenizer, are provided with packages and do not read brother courses or chapter documents.
Compare with the Solution
It is necessary to copy the reliance with the package and indicate the source, and the test is performed from the new decompressable directory; neither brother courses nor author chapter files are required. Model boundary and wordbox agreements should also be specified in README.

CHECK YOUR UNDERSTANDING

Check Your Understanding

Answer first, then open the explanation to check your reasoning. These questions help reveal gaps in understanding; independent implementation and transfer require separate evaluation.

1. Customally defined how to access the pipe?

Show ExplanationThe real CLI reads the same schema and is fully compiled.
2. “I remember.” proves that?

Show ExplanationThere is a need to sustain the return and reopen the playback check.
3. Modify source correct?

Show ExplanationTo keep history in line with the sources of the new architecture.
4. Student acceptance and inspection author's work area?

Show ExplanationThis is the standard library offline project, which operates independently.

Manual completion records your progress; it does not certify your project.